1

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?

3
  • 1
    you could move the data and do a symbolic link from the original location. Mar 27, 2013 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? Mar 28, 2013 at 7:38
  • mv /var/lib/mysql /fast/mysql;ln -s /fast/mysql /var/lib/mysql - see answer below Mar 28, 2013 at 8:03

2 Answers 2

0

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

0

you might want to use a symbolic link

mv /var/lib/mysql /fast/mysql
ln -s /fast/mysql /var/lib/mysql
2
  • 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? Mar 28, 2013 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. Mar 28, 2013 at 9:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .