Articles in this section

Unable to start MariaDB service in a Plesk server: Can't read dir of '/etc/my.cnf.' (Errcode: 2)

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

  • MariaDB fails to start. This can be checked with the below command:

    CONFIG_TEXT: # 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:

    CONFIG_TEXT: 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
  1. Connect to the server via SSH

  2. Create a backup of the initial configuration file:

    # cp -a /etc/my.cnf{,.bak}

  3. Execute the commands below to add an empty line to the end of the file:

    # echo "" >> /etc/my.cnf

  4. Start MySQL service:

    # service mariadb restart

For Debian/Ubuntu
  1. Connect to the server via SSH

  2. Create a backup of the initial configuration file:

    # cp -a /etc/mysql/my.cnf{,.bak}

  3. Execute the commands below to add an empty line to the end of the file:

    # echo "" >> /etc/mysql/my.cnf

  4. Start MySQL service:

    # service mysql restart

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.