MySQL daemon won't start

After years of working fine, MySQL just stopped working the other day. When I try to start mysqld manually with mysqld_safe, I get this:
Starting mysqld daemon with databases from /var/mysql
rm: /var/mysql/mysql.sock: Permission denied
STOPPING server from pid file /var/mysql/quicksilver.lan.pid
081129 12:58:11 mysqld ended

I discovered that trying to manually remove (rm) the mysql.sock file gives the same "Permission denied" error. Even though it seems like the permissions/ownership should allow it:
srwxrwxrwx 1 mysql admin 0 Nov 26 15:25 mysql.sock
Using sudo works to delete the file, but then mysqld_safe gives:
Starting mysqld daemon with databases from /var/mysql
STOPPING server from pid file /var/mysql/quicksilver.lan.pid
081129 13:34:04 mysqld ended

I note the mysql.sock file is 0 bytes: is this wrong?
I don't know what else to try.

QuickSilver dual-800 G4, Mac OS X (10.4.11), X Server

Posted on Nov 29, 2008 5:33 PM

Reply
9 replies

Nov 29, 2008 8:04 PM in response to G Robert Lewis

Be careful about what user you use to start mysqld. Once you start it with root, many of the important files get their owner changed to root preventing mysqld from successfully launching as the mysql user.

I'd try to do a chown to the relevant directories:

sudo chown -R mysql /var/mysql


And make sure you are launching mysqld_safe with the --user=mysql option.

Nov 29, 2008 11:36 PM in response to jaydisc

Good suggestions, but no cigar:

sudo chown -R mysql /var/mysql
Password:
quicksilver:~ robbo$ mysqld_safe --user=mysql
Starting mysqld daemon with databases from /var/mysql
rm: /var/mysql/mysql.sock: Permission denied
STOPPING server from pid file /var/mysql/quicksilver.lan.pid
081129 23:22:01 mysqld ended

Same behavior as before (the chown command was redundant because all the files showed mysql as owner).
I'm guessing mysqld_safe is a script and at some point it's trying to delete the /var/mysql/mysql.sock file and for some unknown reason can't. FRUSTRATING! It all worked just fine for years, starting up all by itself at system boot time.

I wonder if there's a log file somewhere that will explain what the problem is.

Nov 30, 2008 12:42 PM in response to jaydisc

I had redirected the error log to another disk drive (in the my.conf file) and for some reason it wasn't getting written. I changed that to the default location and here's what I get in the terminal window:

mysqld_safe --user=mysql
Starting mysqld daemon with databases from /var/mysql
rm: /var/mysql/mysql.sock: Permission denied
STOPPING server from pid file /var/mysql/quicksilver.lan.pid
081130 10:41:07 mysqld ended

(nothing new there)
And this is what's in the log file:

081130 10:41:07 mysqld started
081130 10:41:07 [Warning] Can't create test file /var/mysql/quicksilver.lower-test
081130 10:41:07 [Warning] Can't create test file /var/mysql/quicksilver.lower-test
081130 10:41:07 [Warning] One can only use the --user switch if running as root

081130 10:41:07 [ERROR] Can't start server : Bind on unix socket: Address already in use
081130 10:41:07 [ERROR] Do you already have another mysqld server running on socket: /var/mysql/mysql.sock ?
081130 10:41:07 [ERROR] Aborting

081130 10:41:07 [Note] /usr/libexec/mysqld: Shutdown complete

081130 10:41:07 mysqld ended


Very odd, as I'm pretty sure I don't have another instance of mysqld running. As evidence, here's what I get when I try to connect with MySQL's GUI admin tool:

Could not connect to MySQL instance at localhost.
Error: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (61) (code 2002)

Nov 30, 2008 5:04 PM in response to jaydisc

Here are the permissions for the socket:
srwxrwxrwx 1 mysql admin 0 Nov 29 23:12 mysql.sock

I'm logged in as an admin, but I'm not allowed to delete the socket:
rm /var/mysql/mysql.sock
rm: /var/mysql/mysql.sock: Permission denied
(which incidentally is the message mysqld_safe prints when it tries to start)
I deleted the socket using sudo once before and it didn't change anything.

Here's the output of ls -al /var/mysql:

total 41416
drwxr-xr-x 22 mysql admin 748 Nov 29 23:12 .
drwxr-xr-x 35 root wheel 1190 Nov 29 23:05 ..
-rw-rw---- 1 mysql admin 6148 Dec 2 2004 .DS_Store
drwx------ 27 mysql admin 918 May 30 2008 MailStewardProDB
drwx------ 14 mysql admin 476 May 24 2007 SharedMedia
drwx------ 8 mysql admin 272 Aug 12 2006 drs
drwx------ 165 mysql admin 5610 Nov 8 18:38 flagNtag
drwx------ 5 mysql admin 170 Sep 13 2004 home_automation
-rw-rw---- 1 mysql admin 25088 Sep 11 2004 ib arch_log0000000000
-rw-rw---- 1 mysql admin 5242880 Nov 19 08:23 ib_logfile0
-rw-rw---- 1 mysql admin 5242880 Sep 11 2004 ib_logfile1
-rw-rw---- 1 mysql admin 10485760 Nov 19 08:23 ibdata1
-rw-rw---- 1 mysql admin 338 Dec 3 2006 localhost.err
drwxrwx--- 51 mysql admin 1734 Jul 18 2006 mysql
srwxrwxrwx 1 mysql admin 0 Nov 29 23:12 mysql.sock
drwx------ 27 mysql admin 918 Sep 10 2007 phpmyadmin
drwx------ 14 mysql admin 476 Dec 27 2007 pim
-rw-rw---- 1 mysql admin 189926 Nov 30 13:46 quicksilver.lan.err
drwx------ 14 mysql admin 476 Sep 12 2004 sg_coalition
drwx------ 6 mysql admin 204 May 9 2007 test
drwx------ 92 mysql admin 3128 Apr 6 2008 weed_bug
drwx------ 24 mysql admin 816 Aug 23 2007 x2web

I don't see any problems here.

Nov 30, 2008 5:44 PM in response to jaydisc

OMG! This worked:

sudo mysqld_safe --user=mysql

Interestingly, even though the database is working, the response to the above command was:

Password:
Starting mysqld daemon with databases from /var/mysql

now it's just sitting there waiting for input (no shell prompt), and I can type stuff and nothing happens until I hit Ctrl-Z:

;
show databases;
^C
^Z
[1]+ Stopped sudo mysqld_safe --user=mysql

What's that about?
And I wonder if mysqld will auto-start at boot time like it always used to.

Anyway, thanks for getting me this far!
The only thing in the error log is this:

081130 17:34:12 mysqld started
081130 17:34:12 [Warning] Setting lower case_tablenames=2 because file system for /var/mysql/ is case insensitive
081130 17:34:13 InnoDB: Started; log sequence number 0 2723749

(which I assume is good)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

MySQL daemon won't start

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.