Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is an issue that is really driving me nuts today:

Basically, I compiled MySQL from source (MySQL 5.1.14 on Ubuntu 9.04 on an ARM machine), and here is what happened when I tried to run it:

/etc/init.d/mysql start
Starting MySQL.. * Manager of pid-file quit without updating file.

Digging into the error log, here is what I see:

110826 18:00:21 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
110826 18:00:22 [ERROR] Can't start server : Bind on unix socket: Permission denied
110826 18:00:22 [ERROR] Do you already have another mysqld server running on socket: /tmp/mysql.sock ?
110826 18:00:22 [ERROR] Aborting

110826 18:00:22 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete

110826 18:00:22 mysqld_safe mysqld from pid file /usr/local/mysql/var/Serv.pid ended

So here is what I tried to do:

touch mysql.sock
chown mysql:mysql mysql.sock
chmod 1777 mysql.sock

And everything seems to be fine:

ls -la | grep mysql.sock
-rwxrwxrwt  1 mysql mysql        0 2011-08-26 18:02 mysql.sock

But guess what, every time I tried to restart mySQL, the same error happened and it seems that for some reason, the sock file was gone.

I was running the whole process as root, so permission should not be a problem.

Any suggestion? Thanks!

share|improve this question
    
Please give us the output of ls -ld /tmp/ and ps -ef | grep mysql? –  quanta Aug 27 '11 at 6:32
    
ls -ld /tmp/ drwxr-xr-x 9 root root 4096 2011-08-27 05:00 /tmp/ –  zhuanyi Aug 27 '11 at 15:02
    
ps -ef | grep mysql root 24779 24758 0 11:02 pts/0 00:00:00 grep mysql –  zhuanyi Aug 27 '11 at 15:02
add comment

3 Answers

up vote 0 down vote accepted

chmod 1777 /tmp and try again.

share|improve this answer
    
This is the solution that works, thanks so much for your help quanta! –  zhuanyi Aug 27 '11 at 15:42
    
How the heck did that happen? Oh well, I'm glad it is working for you. –  mtinberg Aug 28 '11 at 5:54
add comment

You really should not create this file manually, this is not an ordinary file, this is a named socket and it should be listed in ls output something like srwxrwxrwx 1 mysql mysql 0 Aug 20 23:49 mysql.sock=. Are you sure another mysqld is not started on the same socket?

share|improve this answer
add comment

Is Ubuntu set up to use a security framework such as SELinux, SMACK or AppArmor that would need to be modified to allow your custom mysql instance to run? Are the database files that mysql needs owned by the mysql user as mysql does give up root privileges when it runs?

As a side note your attempt to create a socket file is incorrect, you have created a regular file not a socket, you need to use mksock to create a socket file in the filesystem.

share|improve this answer
    
I have no AppArmor nor Selinux installed, tried to run with mysql user to start the instance with no luck as well... –  zhuanyi Aug 27 '11 at 4:24
    
And do you know how to run mksock? There is no command in Ubuntu 9.04 it seems... –  zhuanyi Aug 27 '11 at 4:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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