Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have mysql data mounted to

/var/lib/mysql

And what I want is to move it to

/fast/mysql 

My plan is following:

  1. Stop mysql.
  2. Rsync from /var/lib/mysql to /fast/mysql.
  3. Change my.cnf to point to /fast/mysql.
  4. Run mysql.

Are there any problems with my plan?

share|improve this question
1  
you could move the data and do a symbolic link from the original location. –  Wolfgang Fahl Mar 27 '13 at 19:09
    
@WolfgangFahl, yup, symbolic link seems fast solution. As I understood you suggest to make link from /var/lib/mysql folder to /fast/mysql folder. I mean particularly folder links, not file links? –  Jevgeni Smirnov Mar 28 '13 at 7:38
    
mv /var/lib/mysql /fast/mysql;ln -s /fast/mysql /var/lib/mysql - see answer below –  Wolfgang Fahl Mar 28 '13 at 8:03

2 Answers 2

If you're running apparmor, you'll need to tell it that MySQL is allowed to access the files at the new location.

Your distribution may be configured differently, but on Ubuntu 12.10, you'll need to edit this file:

/etc/apparmor.d/usr.sbin.mysqld

share|improve this answer

you might want to use a symbolic link

mv /var/lib/mysql /fast/mysql
ln -s /fast/mysql /var/lib/mysql
share|improve this answer
    
The only question, why I just can't use point 3 from my plan? I mean why changing value in my.cnf is not good solution and I need to use link? –  Jevgeni Smirnov Mar 28 '13 at 8:43
    
My answer is about the move part more than the cnf part. You proposal was copying, I don't know whether you where intending to copy. –  Wolfgang Fahl Mar 28 '13 at 9:33

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.