I have installed MySQL
on a RHEL 5 server
and I want to set it up so that the server starts on boot.
I've ran the chkconfig --list mysqld
command and it's currently running on levels 3, 4 and 5. However, when I reboot the server, no mysqld
daemon is started.
I've also tried manually starting the server by executing /usr/bin/mysqld_safe
and I get the following output:
Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysqld/mysqld.pid
100319 10:31:30 mysqld ended
I looked in /var/log/mysqld.log
and I found the following:
100319 10:29:01 mysqld started
100319 10:29:02 InnoDB: Started; log sequence number 0 29752204
100319 10:29:02 [ERROR] Can't start server : Bind on unix socket: Permission denied
100319 10:29:02 [ERROR] Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?
100319 10:29:02 [ERROR] Aborting
UPDATE: I tried starting using the mysql.server
script (from /usr/share/mysql
) and it worked.So I went ahead and linked this script to the appropriate run levels (rc0.d
, rc3.d
and rc5.d
). However, it's still not starting on boot.
Is this version of mysqld from the official repository or an rpm that you downloaded from mysql.com?
If mysql.server script works then you should be able to copy it to /etc/init.d and then symlink to it from /etc/rc3.d rc4.d and rc5.d.
Edit: But you'll need to use chkconfig to turn mysqld off first before you do the symlinks.
Remove /var/lib/mysql/mysql.sock and then chkconfig mysqld on. You can get a menu of services by running ntsysv. Use man chkconfig and man ntsysv to learn more about how to use those programs.
You may also want to install the
strace
package (it's in the standard YUM repository), then run:You should be able to determine pretty quickly where the error lies.
On RHEL/CentOS, you generally want to use the init script for stopping and starting the mysqld daemon -- it does a lot more than simply start
/usr/bin/mysqld_safe&
.If the process is not already running, here are some options I see..
/var/lib/mysql/mysql.sock.
You can try removing this file and restarting the daemon.Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?
netstat -l -p -d as root and see if anything is listening on the mysql port.