Symptoms
-
MariaDB fails to start. This can be checked with the below command:
# systemctl status mariadb.service
 mariadb.service - MariaDB database server
[...]
Jan 19 11:58:17 server_name mysqld_safe[3568]: Fatal error in defaults handling. Program aborted
Jan 19 11:58:17 server_name mysqld_safe[3568]: [74B blob data]
Jan 19 11:58:17 server_name mysqld_safe[3568]: Fatal error in defaults handling. Program aborted
Jan 19 11:58:17 server_name mysqld_safe[3568]: 170119 11:58:17 mysqld_safe Logging to '/var/lib/mysql/server_name.err'. -
The following error can be found in
/var/log/mariadb/mariadb.log
:170119 11:52:41 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: Can't read dir of '/etc/my.cnf.' (Errcode: 2)
Fatal error in defaults handling. Program aborted
170119 11:52:41 mysqld_safe mysqld from pid file /var/lib/mysql/server_name.pid ended
Cause
Misconfiguration of MySQL configuration file.
Resolution:
For Centos
-
Connect to the server via SSH
-
Create a backup of the initial configuration file:
# cp -a /etc/my.cnf{,.bak}
-
Execute the commands below to add an empty line to the end of the file:
# echo “” >> /etc/my.cnf
-
Start MySQL service:
# service mariadb restart
For Debian/Ubuntu
-
Connect to the server via SSH
-
Create a backup of the initial configuration file:
# cp -a /etc/mysql/my.cnf{,.bak}
-
Execute the commands below to add an empty line to the end of the file:
# echo “” >> /etc/mysql/my.cnf
-
Start MySQL service:
# service mysql restart