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?

jscott
  • 24,204
  • 8
  • 77
  • 99

1 Answers1

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.

dwlz
  • 891
  • 3
  • 10
  • 19
  • 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 –  Dec 09 '09 at 02:46
  • Alright, then we're almost there. See my edit above. – dwlz Dec 09 '09 at 04: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! –  Dec 09 '09 at 21:35
  • I would vote up this answer, but don't have the required 15 reputation; sorry :( –  Dec 09 '09 at 21:36
  • It's alright, no problem! – dwlz Dec 09 '09 at 21:56
  • 1. I don't have a my.cnf anywhere on my system. I do have files that mysql installed in /support-files called my.cnf (small, med and large). And they all have /tmp/mysql.sock set. 2. I get this error right after installing mysql on a new machine. – Stephen Cox Jan 22 '11 at 15:06