Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

After I setup mysql 5.5, I changed the data dir to another folder and modify the related config in my.cnf. This is quite simple, but mysql cannot start anymore even if reinstall or not change data dir.

The error log has no useful information, so I cannot find any reason.

111207 16:28:02 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 111207 16:28:02 mysqld_safe mysqld from pid file /var/lib/mysql/ ended

But if I use the command as the start script, mysql starts normally.

/usr/bin/mysqld_safe --datadir=/data/mysql/ --pid-file=/data/mysql/ > /dev/null 2>&1

Much more strange, I use /usr/share/mysql/mysql.server start instead of /etc/init.d/mysql start, mysql also can start without error, while these two files are the same. So in the end I have to use cp -l /usr/share/mysql/mysql.server /etc/init.d/mysql to fix the problem.

I really want to know why and if there is a better solution!

share|improve this question

migrated from Dec 7 '11 at 10:36

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

closed as off topic by sysadmin1138 Dec 8 '11 at 7:32

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

@passover: What is your OS / distro? – Khaled Dec 7 '11 at 12:17
O hai, puppet.. – Tom O'Connor Dec 7 '11 at 13:00
Puppet is not a distro of Linux; it is a configuration change utility. To find out what distro of Linux you're running, type cat /etc/issue and paste the results here. – Kevin M Dec 7 '11 at 22:53
@Kevin M: CentOS release 5.6 (Final) Kernel \r on an \m – passover Dec 16 '11 at 3:09

It is hard to say without seeing the contents of your original init.d script but the error message above makes it seem like it is still looking in the default /var/lib/mysql for the data directory.

Perhaps the data directory is hardcoded in the init.d script, or the init.d script could be looking for a my.cnf in a place you aren't expecting (it varies by distro).

share|improve this answer

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