0

Our server just crashed after a 140 day uptime reboot (not booting). It was running Plesk and since it's hosted by Online.net, I'm able to run a recovery system and access my data. It was running a MySQL server with a few databases & tables. I need to access the databases and export them so I can reinstall the server. The server was running CentOS, and the recovery system is Ubuntu 12.04. Is there any way I can get the databases or start the original MySQL server?

Thank you!

1

On a default CentOS 6 system, mysql stores it's files in a tree rooted at `/var/lib/mysql

Copy the files from the crashed system's /var/lib/mysql/... and the /etc/my.cnf file to a safe place.

  • Build a CentOS system and install mysql.
  • Shutdown (if started) the mysql service on the new system
  • Copy the saved my.cnf file to /etc on the new system
  • Delete the contents of the new systems /var/lib/mysql tree.
  • Copy the contents of the saved mysql tree into /var/lib/mysql on the new system.
  • Start the mysql service (with everything crossed).

If you're lucky then the system will be up and running and you will be able to inspect it for data loss etc.

If it fails you will have to look at the logs and take appropriate action based upon what you find.

Note: the important thing here is to work with copies of the data you have recovered from the crashed system.

Now consider taking regular backups of your data too.

1

First of all you need to ensure that the partition (the one that the mysql data dir was) is mounted somewhere (say /mnt/old_root) on the recovery system.

Then chroot to this dir:

chroot /mnt/old_root

Then try to start mysql:

/etc/init.d/mysql start

And finally dump the databases that you want:

mysqldump -u admin -p`cat /etc/psa/.psa.shadow` database_name > database_name.sql

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.