How to restore full mysql (dir)

  • Hi.
    My problem is: I'm saved the /var/www/virtual and the /var/lib/mysql directories. And after reinstall OS I set up the IMSCP and when restored these two directories i'm got error in mysql server. So MySQL server don't want to start up.
    So what way can i restore the mysql database directory?

  • Did you stop the mysql-daemon before copying the files? Because otherwise it's kinda dirty method to transfer mysql's data, as you don't know if there was data left in the memory that had to be written into the database.

  • 1. this is not a contribution nor a howto, so i moved this topic to support / migration. next time think.


    2. i bet you copied the folder without preserving atributes. so fix permissions on /var/lib/mysql (chown + chmod) then restart mysqld.


  • 2. i bet you copied the folder without preserving atributes. so fix permissions on /var/lib/mysql (chown + chmod) then restart mysqld.


    I'm fixed permissions to 777 and i'm chown to Group: mysql [110] and to User: mysql [106] and doesn't work.
    I'm used these commands: chown -R mysql.mysql /var/lib/mysql and chmod -R 777 /var/lib/mysql.


    The MySQL server don't start after I copy the ibdata1 file.

  • after reinstalling your server, you also installed same version of mysql-server as on the old os?


    try to run mysqld with following command: mysqld_safe --skip-grant-tables &


    if that works, you can create a dump of your databases, and reinstall newer mysql version of mysql-server and restore from dump.

  • after reinstalling your server, you also installed same version of mysql-server as on the old os?


    try to run mysqld with following command: mysqld_safe --skip-grant-tables &


    if that works, you can create a dump of your databases, and reinstall newer mysql version of mysql-server and restore from dump.


    Don't start the MySQL server with this command: mysqld_safe --skip-grant-tables &


    you also need the old /etc/mysql/debian.cnf file


    I'm don't have the old debian.cnf file

  • then reinstall mysql-server cleanly, uninstall with purge, and remove /var/lib/mysql then install it again and install imscp
    create every customer database manually with exact names like they were before
    now stop mysql and copy only the /var/lib/mysql/databasename-folders but not /var/lib/mysql/mysql and the files in /var/lib/mysql/ from backup
    start mysql again and you have all your databases with old data
    now you can restore database user bindings, also manually


    and think about a better backup strategy