PID error on mysql.server start?

Solution 1:

I ran into this same problem when installing via homebrew. Make sure you run these commands (which are listed during install but easy to miss):

unset TMPDIR
mysql_install_db

Solution 2:

You probably need to ensure that you're running mysql as the root user -- otherwise it won't have permission to write the PID file (thus the error you're receiving).

Try this:

sudo mysql.server start

You'll be prompted for your password. (this assumes that your user account has permissions to "sudo" -- which it should, unless it's setup as a restricted user account in OS X).

This may not be the only issue -- but it should get you to the next step anyway.

Solution 3:

I ran into the same issue while trying to install MySQL 5.5.15 in Lion using homebrew and resolved the issue with:

mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

and creating a the file ~/my.cnf

with the content:

 [mysqld]
   basedir=/usr/local/Cellar/mysql/5.5.15
   datadir=/usr/local/var/mysql

basedir - should be your current MySQL instalation dir datadir - should be the location of MySQL data

You can figure out that too location by watching the make command during the "brew install mysql" searching for something like this:

-DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/mysql/5.5.15 -DMYSQL_DATADIR=/usr/local/var/mysql -DINSTALL_MANDIR=/usr/local/Cellar/mysql

Where DCMAKE_INSTALL_PREFIX = basedir and DMYSQL_DATADIR = datadir

Solution 4:

These following two commands should solve your issue.

> unset TMPDIR
> mysql_install_db --verbose --user=\`whoami\` --basedir="$(brew
--prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp