MariaDB/MySQL Will Not Start

ERROR: When there is a database error where your sites can't connect to the db. This happened to me when I used the ‘Duplicator' plugin for wordpress to install a new site which also connected and setup the db tables. I'm not sure why, but it is probably the setting in the plugin's package that need to be tweaked. Anyway, the error message is something like:

ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)

Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details

You just need to chown the new database to have mysql as the user. When looking inside ‘/var/lib/mysql' you can see that the new database has only root privileges. We chown it to mysql and it works. However, the permissions are still different from the others and I'm not sure what difference this makes. All of the databases have directory permmissions of 0700 and within each directory the files are 0660. The new directory has a permission of 0755 and the files within are 0644.

First, to correct the error:

$ sudo chown -R mysql:mysql /var/lib/mysql

$ sudo service mysql start

This chown's all of the directories although only the new directory will be affected because the other directories already have mysql as the user/owner. You could just chown that particular directory if necessary.

So, I also chmod'ed the directory and files:

$ sudo chmod -R 0660 /var/lib/mysql/sitedirectory/

$ sudo chmod 0700 /var/lib/mysql/sitedirectory

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.