0

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.

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

2 Answers 2

1

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.

0

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

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

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.

You must log in to answer this question.

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