0

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.

Abhijeet Kasurde
  • 985
  • 9
  • 20
Brian
  • 231
  • 8
  • 18

5 Answers5

1

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.

anonymouse
  • 239
  • 1
  • 2
  • Okay, I turned off chkconfig, created the sym links and then turned chkconfig back on. When I rebooted, I checked the processes for mysql and it only showed this: > root 3306 2258 0 12:59 ? 00:00:00 /bin/sh /etc/rc5.d/S64mysqld start Then when I ran ps again, it showed nothing (i.e. MySQL hadn't started). – Brian Mar 19 '10 at 17:30
  • Correct me if i'm wrong but for some reason i get the feeling you're not running a mysql version provided by redhat and this is the cause of your problems. When you create symlinks by hand you don't need to use chkconfig (that's one of the things chkconfig does). ln -s /etc/init.d/mysql.server /etc/rc3.d/S65mysqld – anonymouse Mar 20 '10 at 00:14
  • I downloaded the RPM files from the MySQL site: MySQL-client-standard-5.0.27-0.rhel4.i386.rpm and MySQL-server-standard-5.0.27-0.rhel4.i386.rpm. I needed the older version because the application I'm installing requires it. – Brian Mar 24 '10 at 12:51
1

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.

Dustin
  • 199
  • 3
1

You may also want to install the strace package (it's in the standard YUM repository), then run:

strace /etc/init.d/mysqld start

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

Joe
  • 1,765
  • 15
  • 23
  • I tried running strace and got a bunch of output but none of it really makes any sense to me... – Brian Mar 19 '10 at 17:32
0

If the process is not already running, here are some options I see..

  • Is something else listening on 3306? (Unlikely)
  • You are running as a user that does not have access to /var/lib/mysql/mysql.sock. You can try removing this file and restarting the daemon.
Warner
  • 23,440
  • 2
  • 57
  • 69
  • I cannot connect to the MySQL client and there is no process running when I run "ps -ef | grep mysql". – Brian Mar 19 '10 at 15:16
0

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.

The Unix Janitor
  • 2,388
  • 14
  • 13
  • I tried the command you gave and there is nothing listening on the port that MySQL is supposed to be running on. – Brian Mar 19 '10 at 15:17
  • hmm, bizzare. check your mysqld.conf, and check the running port. Do you have a security policy that stops processes binding to ports? any thing in /var/log? – The Unix Janitor Mar 19 '10 at 15:23