What to do if MariaDB doesn’t Start?

Though MariaDB is a reliable and stable DBMS, it may fail to start due to many reasons. When
dealing with this critical problem, you should first start the controls on the right foot. The first
place to look at is the error log. MariaDB writes its vital information in the host-name.err log file in
the data directory. If you start MariaDB manually, this information is redirected to the console.
Another place where you must look is the option file. Its default name is my.cnf. It contains the
configuration options.
When you check the error log, you may see different errors. Let us discuss these errors and
their solutions.

Error: Invalid option/Invalid value

The error log may show the following message:
240112 07:45:01 [ERROR] /usr/local/mysql/bin/mysqld: unknown variable
‘option=value’


It means that the option file contains an invalid option or an invalid option value.
This problem may arise after upgrading to a newer version of MariaDB. It might have happened
that some options were removed in the latest version of the DBMS or the valid values were
changed.


Solution: Open the option file and check if paths and values are correct.

Error: Can’t Open Privilege Tables


This error means that there is a problem with the system tables. These internal tables are used by
MariaDB to store essential information about the functioning of the database. It might have
happened that these tables are missing or located at the wrong places.

This problem may arise after an upgrade to a newer version of MariaDB when you placed these
files at a location that is “non-standard” by setting in the option file custom values for the basedir
or datadir variables.
The error log may display the following message:
System error 1067 has occurred.
Fatal error: Can’t open privilege tables: Table ‘mysql.host’ doesn’t exist

Solution: You must check the my.cnf option file and verify if the values of the basedir and datadir
variables are correct. If system tables are missing, you need to recreate them using the mariadb-
install-db.

Error: Can’t Create Test File


This error occurs when MariaDB is not able to write into the data directory (datadir). The error log
file may show the following message:
Feb 14 10:24:28 mariadb3 mysqld[19221]: 2023-06-21 07:12:11 0 [Warning] Can’t
create test file /usr/local/data/mariadb/mariadb3.lower-test
Feb 14 10:24:28 mariadb3 mysqld[19221]: 2023-06-21 07:12:11 0 [ERROR] Aborting
It looks this is a permission error, affecting the datadir folder.

Solution: Check the following:

 The MySQL user who is executing the mysqld process owns Datadir.
 The owner has the execute directory permissions.
 Parent directory has the execute permission for all.

Error: Can’t Lock Aria Control File


The Aria_log_control is a file that contains information about the configuration of Aria. It contains
the ID of the current transaction, the unique ID, the number of the next log files, and other
information.
If MariaDB cannot lock this file, the following error is generated:
2023-06-21 08:02:57 0 [ERROR] mariadbd: Can’t lock aria control file
‘/var/lib/mysql/aria_log_control’ for exclusive use, error: 11. Will retry for
30 seconds.

Usually, it happens when another existing Maria DB service is running on the same data
directory.


Solution: Check the NFS data directory and see that the options, such as “Disables file locking”, are
enabled.

Error: Unable to lock/ibdata1 error 11


This error occurs when MariaDB tries to lock the InnoDB system tablespace file – ibdata1 but
cannot lock it.

The “error 11” refers to the system error “OS error code 11: Resource temporarily unavailable.” It
means that the OS cannot create a lock on a file.
2023-05-01 16:27:34 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
2023-05-01 16:27:34 0 [Note] InnoDB: Check that you do not already have another
mariadbd process using the same InnoDB data or log files.
2023-05-01 16:27:34 0 [ERROR] InnoDB: Plugin initialization aborted with error
Generic error
2023-05-01 16:27:35 0 [Note] InnoDB: Starting shutdown…
This error usually appears when another instance of the datab
ase engine is running in the same
data directory.


Solution: Check if another instance of the database engine is running.

Error: Cannot Allocate Memory for the InnoDB Buffer Pool


This error is related to the InnoDB Storage Engine. It occurs when the buffer pool uses more
memory than it can allocate and uses a swap disk area.
If the swapping functionality is disabled or the swap area does not have enough space, then it
crashes. The message in the log will be:
240112 09:03:01 InnoDB: Fatal error: cannot allocate memory for the buffer pool


Solution: You can either add more memory or decrease the innodb_buffer_pool_size variable
values.

Error: InnoDB: Database page corruption on disk or a failed


This error is related to the InnoDB table corruption which has crashed due to table corruption . This
happens to avoid the propagation of the corruption.
When InnoDB crashes, the server writes the following message in the error log:
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 7.
InnoDB: You may have to recover from a backup.


Solution:
You can start the MariaDB server and set the value of the innodb_corruption_table_action variable to “warn”.

Error: Corruption in MyISAM system table

MyISAM tables, in fact, are used by MariaDB to store internal (and crucial) information. If MariaDB
crashes, then it can lead to corruption in MyISAM system table. By default, MariaDB will not start
in case of corrupted system table.


Solution: If you need to start the MariaDB server, set the variable myisam_recover_options.
This will force the MyISAM storage engine to repair the corrupted table.

To Conclude

Above, we have discussed an extensive list of errors, along with their solutions. However, it may
happen that you are not able to fix the problem and cannot restart the MariaDB instance. In such
a case, you can restore the data from a backup. If you do not have a backup or it is corrupted too,
then the only solution is to use a powerful MySQL repair software, such as Stellar Repair for
MySQL .
This recovery software supports both MySQL and MariaDB RDBMS. It can fix corrupted
InnoDB and MyISAM tables and recover all the objects, including keys, triggers, and functions.

Leave a Reply

Your email address will not be published. Required fields are marked *