Symptoms
MariaDB fails to start:
# systemctl status mariadb
<..>
Database MariaDB is not initialized, but the directory /var/lib/mysql is not empty, so initialization cannot be done./var/lib/mysqldoes not havemysqldirectory in it:# ls -l /var/lib/mysql | grep mysql
# (empty output)
Cause
MariaDB set up is corrupted or incomplete.
Resolution
Connect to the server via SSH
Stop MariaDB:
# systemctl stop mariadb
Move all content out of
/var/lib/mysqldirectory:# mkdir /var/lib/mysql_bk && mv /var/lib/mysql/* /var/lib/mysql_bk
Start and then stop MariaDB:
# systemctl start mariadb
# systemctl stop mariadbCopy contents from backed-up directory to
/var/lib/mysql:# cp -a /var/lib/mysql_bk/* /var/lib/mysql
- Open the
my.cnffile with a text editor:on CentOS/RHEL-based distributions
# vi /etc/my.cnf
on Debian/Ubuntu-based distributions
# vi /etc/mysql/my.cnf
- Add the skip-grant-tables directive under the
[mysqld]section:[mysqld]
skip-grant-tables
bind-address = :: Restart MariaDB and restore the mysql database from daily dump:
# zcat /var/lib/psa/dumps/mysql.daily.dump.0.gz | sed -n '/-- Current Database:
mysql/,/-- Current Database:*/p' | plesk db- Restore the admin user by following the instructions from the article "Unable to access Plesk UI or its database on Linux: Access denied for user 'admin'@'localhost' (using password: YES)";
- Remove the skip-grant-tables directive under the
[mysqld]section of themy.cnffile. Restart MariaDB:
# systemctl restart mysql && systemctl restart mariadb