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
Solution 5
Nothing else really helped, but the following worked:
$ ps aux | grep mysql
tagir 27260 0.0 1.0 3562356 175120 ?? S 2:52PM 0:00.42 mysqld --skip-grant-tables
tagir 42704 0.0 0.0 2434840 784 s000 S+ 3:04PM 0:00.00 grep mysql
$ kill 27260
# Careful! This might erase your existing data
$ rm -rf /usr/local/var/mysql
$ mysqld --initialize
$ mysql.server start
joecritch
Updated on June 11, 2020Comments
-
joecritch almost 4 years
I've just tried installing MySQL using homebrew (on Mac OS X 10.6), but I've run across an issue at the first hurdle. When trying to manually start the server (mysql.server start), I get the following error:
. ERROR! Manager of pid-file quit without updating file.
Unfortunately I'm not sure of which error logs or configuration files to check, as I've never installed MySQL in this way before.
-
joecritch over 13 yearsThank you sir. That seems to have done the trick, prior to performing the following action: sudo chown -R
whoami
/usr/local -
Mayank Jaiswal about 9 yearsOMG! Why can't mysql simply say that "you do not have sufficient permissions". "ERROR! The server quit without updating PID file" is an extremely misleading error message.
-
New Alexandria over 8 years@MayankJaiswal because the reason for a PID file not being created could be another reason besides permissions.
-
Mayank Jaiswal over 8 years@NewAlexandria I agree that there can be many reasons for not being able to read PID file. But why not be as specific as possible? An extreme example: your compiler tries very hard to pin point the error and not just says "Some error in file foo.py. Cant compile.". Instead, it would say "Parse Error on line 36 character 26, unexpected identifier: ';' " - isn't that sweet ?
-
New Alexandria over 8 yearsI think you should submit a patch to the open-source repo maintainers.
-
Samuel almost 8 yearsThis outputs exceptions:
2016-05-31 10:47:27 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize 2016-05-31 10:47:27 [ERROR] The data directory needs to be specified.
-
Kxrr over 7 yearsIt works on MYSQL 5.7.13(Installed via Homebrew).
unset TMPDIR && cd /usr/local/var/mysql/ && rm * && mysqld --initialize
Note that will clean you data. -
Oscar Pérez over 7 yearsI came to this error just after upgrading to Sierra. I tried to change permissions, but the error persist... any other idea?
-
rmcsharry over 7 yearsYou could try to reinstall mysql
-
Oscar Pérez over 7 yearsIt is odd... I solved the problem moving the datafiles to another path...
-
dǝɥɔS ʇoıןןƎ over 6 yearsThanks @Kixoms. I modified your code to
set -e TMPDIR; cd /usr/local/var/mysql/; sudo rm -rf *; sudo mysqld --initialize
for Fish. Then just to be safe didbrew uninstall mysql
-
user124384 almost 6 yearsI don't have the directory
/usr/local/var/mysql/
. -
user124384 almost 6 yearsFor some reason, initializing the database, deleting it, and then initializing it again worked for me.
-
kasimir over 5 yearsI've built MySQL from source, didn't know
mysqld
would have aninitialize
option, but it works great when you have to do the 'plumbing' yourself! -
nima almost 5 yearsI searching for a while but nothing worked for me but your answer fixed my error. Thanks