THE SETUP
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.
THE PROBLEM
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.
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 als -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:
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
to it and then restart AppArmor
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.