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.

I have recently installed Snow Leopard onto my Mac, and MySQL stopped working. I went into the terminal and used 'rm -r' on my old directory, and redownloaded the new version from the mysql website. I followed all of the instructions on HiveLogic, but am getting the error listed in the title.

When I run 'locate mysql.sock', I don't get any results. 'locate .sock' returns results that down seem like they relate to the problem. My understanding is that I need to restart mysqld, but the instructions that I have found on other questions don't seem to do that for me. How do I restart mysqld?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You can kill the mysql process manually.

$ ps ax | grep mysql

Note the process id. Then,

$ kill __pid__

Next thing you should do is edit your my.cnf file, and check to make sure that the socket location is /tmp/mysql.sock. For example, this is what my [client] section looks like:

[client]
user=mysql
port=3306
socket=/tmp/mysql.sock

Let's say $MYSQL is your MySQL folder (in the case of the tutorial you provided, it's probably in /usr/local/mysql/bin). If you haven't already done so, you have to set up your databases and give your superuser a password.

$ useradd mysql
$ cd $MYSQL
$ ./mysql_install_db

Start MySQL here. Then:

$ ./mysqladmin -u root password '<your_password>'
$ chown -R mysql:mysql /usr/local/mysql/var

Then run sudo ./mysqld_safe --user=mysql & and you should be set.

share|improve this answer
    
1) '$ ps ax | grep mysql' only returns the actual grep command itself. I guess there is currently no mysqld daemon running 2) my.cnf is located in /private/etc/, and has [client] socket=/tmp/mysql.sock at the bottom; do I need the user and port if I'm currently only running it on my own machine? 3) I downloaded the source, and built the binary using the unix developer tools, but I had the same problem when I installed via MacPorts Thank you very much for any help you can provide –  user28563 Dec 9 '09 at 2:46
    
Alright, then we're almost there. See my edit above. –  dlo Dec 9 '09 at 4:04
    
running mysql_install_db gave me an error "091209 13:26:17 [ERROR] /usr/local/mysql/libexec/mysqld: Can't find file: './mysql/db.frm' (errno: 13) ERROR: 1017 Can't find file: './mysql/db.frm' (errno: 13) 091209 13:26:17 [ERROR] Aborting " which helped me track down the issue. Your chown line should've been "sudo chown -R mysql:mysql /var/lib/mysql". After that, everything worked. Thank you so much for your help! –  user28563 Dec 9 '09 at 21:35
    
I would vote up this answer, but don't have the required 15 reputation; sorry :( –  user28563 Dec 9 '09 at 21:36
    
It's alright, no problem! –  dlo Dec 9 '09 at 21:56

Your Answer

 
discard

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