Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

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
add comment

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.