-1

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/localhost.localdomain.pid 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/localhost.localdomain.pid > /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!

4
  • @passover: What is your OS / distro?
    – Khaled
    Dec 7, 2011 at 12:17
  • O hai, puppet.. Dec 7, 2011 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, 2011 at 22:53
  • @Kevin M: CentOS release 5.6 (Final) Kernel \r on an \m
    – passover
    Dec 16, 2011 at 3:09

1 Answer 1

0

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).

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