First-Aid for MariaDB with Plesk

First-Aid for MariaDB with Plesk

Your MariaDB server does not start? Then you should switch to recovery mode and backup your databases. For this you should first switch off nginx and Apache:

service nginx stop
service apache2 stop
service mysql stop

We open the MariaDB configuration file with

nano /etc/mysql/my.cnf

and add the following settings under “[mysqld]”:

skip-grant-tables #disables password queries
innodb_force_recovery = 1 #enable rescue mode
connect_timeout = 600
net_read_timeout = 600
wait_timeout = 28800
interactive_timeout = 28800
innodb_thread_concurrency = 0
skip-name-resolve = 1

To be on the safe side, we can also make a backup of the clean files in the off state with

cp -rfv /var/lib/mysql /var/lib/mysql$(date +%s)

After that we start mysql again

service mysql start

A backup of a single database can be done afterwards with

mysqldump database > /home/database.sql

can be created.

All databases at once can be backed up with

mysqldump -x -A > /home/databases.sql

can be backed up.

Single database can be backed up with

mysqlcheck DATABASE

to check for errors.

If nothing else helps we can find the Plesk backups (if enabled) under

/var/lib/psa/dumps

From a new server we could restore them with

scp -r [email protected]:/var/lib/psa/dumps /var/lib/psa/

directly from the old server to the new one.

Leave a Reply

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