Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to move a database from an old disk which is no longer bootable to a new bootable disk. I have been able to mount the old disk. Now I need to move the database from there to a new disk. Can this be done? Where do I start and what do I need to move?

share|improve this question

You should be able to create a new database with the same name on the new system, shut down the service, replace the new (empty) files for your database with the old ones and finally start the service again. See for more info.

share|improve this answer
Thank you. I've printed the information out and will try it. – Digiplay Sep 23 '13 at 21:29

Make sure that you have logged in as root

  1. Shut down MySQL server (myqsladmin shutdown)
  2. Edit /etc/my.cnf and set the data-dir configuration option to the new location of your MySQL data directory.
  3. Move your entire data directory to the new location, ie: mv /var/lib/mysql/* /mnt/mysql/
  4. Ensure permissions are correct, chown -R mysql:mysql /mnt/mysql
  5. Start MySQL as usual.
share|improve this answer
+1 but I'd use cp instead of mv just in case something goes wrong in the process. It's basically copying anyway when you mv from one filesystem to the other. – Bill Karwin Nov 3 '13 at 23:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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