1

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?

1 Answer 1

3

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.

6
  • 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, 2009 at 2:46
  • Alright, then we're almost there. See my edit above. Dec 9, 2009 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, 2009 at 21:35
  • I would vote up this answer, but don't have the required 15 reputation; sorry :(
    – user28563
    Dec 9, 2009 at 21:36
  • It's alright, no problem! Dec 9, 2009 at 21:56

You must log in to answer this question.