Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
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

1 Answer 1

up vote 6 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.
share|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

Your Answer

 
discard

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.