The current partition of mine mysql databases is full so it denies to start. How can i move databases to another partition without losing anything.

Edit: I am on Ubuntu 10 Server.

Thanks

link|improve this question

78% accept rate
Before doing any of that do a mysql backup - just in case and move that backed up file out of the way. Always backup b4 touching the production. – Nikolas Sakic Jun 19 '10 at 0:44
feedback

1 Answer

up vote 5 down vote accepted

As root:

  1. Cleanly shut down MySQL (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.
link|improve this answer
Remember to do these operations as root. – lg. Jun 18 '10 at 15:49
You rules, works awesomely :D – user44520 Jun 18 '10 at 16:30
feedback

Your Answer

 
or
required, but never shown

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