I'm running Linux CentOS on an Amazon EC2 instance.

The MySQL data files are on an EBS Drive mounted at /data/ ( symlink - /var/lib/mysql >> /data/mysql ).

Everything works fine in this setup.


I'm trying to move everything from this EBS drive to a new drive. I umounted the /data/ drive, and mounted it at /data2/. Then I mounted the new drive at /data/ and copied everything over to it from /data2/. Everything on the system works great, except MySQL. Every time I try to start the MySQL daemon ( /etc/init.d/mysqld start ) I get a MySQL Daemon failed to start error.

migrated from stackoverflow.com Oct 4 '11 at 19:57

This question came from our site for professional and enthusiast programmers.

  • What does /var/log/syslog say? – Michel Oct 4 '11 at 19:36
  • The first thing you should take a look at is /var/log/mysqld.log (or similar). – quanta Oct 5 '11 at 2:29

The problem was in the user permissions.

I did a sudo chown -R mysql:mysql /data/mysql and it fixed the problem. It was important that I included the recursive -R in there because it looked like all the files had the correct user 'mysql' when I did a ls -l. They apparently did not, however.

The MySQL daemon now starts fine when I run sudo /etc/init.d/mysqld start.


I recently moved my MySQL DBs from one drive to another as you did and had the same problem. These problems become kind of clearer if you refer to the syslog as @Michel says:

  1. Cleanly stop MySQL
  2. Only move your DB directories to the new directory, not every file in the DB directory
  3. Edit your /ec/my.cnf file to point to the new directory
  4. Restart MySQL

I did all this and it still would not start and finally I figured out it was because AppArmour was stopping it. If you are running AppArmor on your box, you will have to edit the


file and add

/path/to/new/dir/ r,
/path/to/new/dir/** rwk,

to it and then restart AppArmor

service apparmor restart

Now restart MySQL

Note that these are Debian paths and the config files I mention might not be in exactly the same spot on your CentOS box.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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