Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to have MySQL point to a directory on an EBS volume I mounted on my EC2 machine.
I took th following steps:

  1. Stopped MySQL (/etc/init.d/mysqld stop) - successful
  2. Created a MySQL directory on my volume, mounted on /vol (mkdir /vol/mysql)
  3. Copied the contents of /var/lib/mysql to /vol/mysql (cp -R /var/lib/mysql /vol/mysql)
  4. Chanded the owner and group of that directory to match the original (chown -R mysql:mysql /vol/mysql) - after this step, the 2 directories are identical.
  5. Edited the /etc/my.cnf file (commented 2 original lines):

  6. Started MySQL (/etc/init.d/mysqld start) - FAILED

The error file /var/log/mysqld.log contains the following lines:

100205 20:52:54  mysqld started  
100205 20:52:54  InnoDB: Started; log sequence number 0 43665  
100205 20:52:54 [Note] /usr/libexec/mysqld: ready for connections.  
Version: '5.0.45'  socket: '/vol/mysql/mysql.sock'  port: 3306  Source distribution  

No other errors are available.

  1. What am I doing wrong?
  2. Where can I find the error/s encountered by MySql?
  3. If I restore the original lines, MySQL starts, leading me to believe it may be a permissions issue - but permissions are the same for both directories?


share|improve this question
cp -Rp copies and preserves permissions. – Philip Reynolds Feb 6 '10 at 2:39
Good tip for next time - still doesn't solve my problem :) – Traveling Tech Guy Feb 6 '10 at 2:48
Best I can suggest is to set -x when you run the mysqld script (sh -x /etc/init.d/mysqld start) - at least that will show you the exact command that's failing, which will hopefully give you a clue. – gareth_bowles Feb 6 '10 at 7:01
up vote 1 down vote accepted

I took Garth's suggestion and ran the script with sh -x. I found out there are permission issues when accessing the mysql.sock file. So I left the old one in the conf file, ran it again and ta-da it works and runs from the new location!

Thanks Gareth for showing me the way. I gave you a +1 on the comment but you did not post an answer.

Hopefully, this question will help some other people trying to do the same.

share|improve this answer
Glad to be of help ! You really figured out the problem, so you should vote for your answer as the right one. – gareth_bowles Feb 8 '10 at 22:00
Thanks for the pointer though. Completely forgot about mysqld being a shell script :) And here's another point for the comment :) – Traveling Tech Guy Feb 9 '10 at 1:01

Try mount the original paths using bind.

Mount then shows:

/vol/etc/mysql on /etc/mysql type none (rw,bind)
/vol/lib/mysql on /var/lib/mysql type none (rw,bind)
/vol/log/mysql on /var/log/mysql type none (rw,bind)

And config file still looks as before:

socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
share|improve this answer

Your Answer


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.