Recovering from flat files requires you to stop the MySQL server, replace all the files, change the permissions, and start MySQL.
- Stop the MySQL server:
shell> sudo systemctl stop mysql
- Move the files to the
data directory
:
shell> sudo mv /backup/mysql /var/lib
- Change the ownership to
mysql
:
shell> sudo chown -R mysql:mysql /var/lib/mysql
- Start MySQL:
shell> sudo systemctl start mysql
Note
To minimize the downtime, if you have enough space on disk, you can copy to the backup to /var/lib/mysql2
. Then stop MySQL, rename the directory, and start the server:
shell> sudo mv /backup/mysql /var/lib/mysql2 shell> sudo systemctl stop mysql shell> sudo mv /var/lib/mysql2 /var/lib/mysql shell> sudo chown -R mysql:mysql /var/lib/mysql shell> sudo systemctl start mysql