For some time I was successfully using MySQL on my Mac (OS X 10.9) installed from the DMG. However, one day it has crashed and I could not restart the server again. I tried to reinstall it several times, both with DMG and homebrew
, but nothing worked.
If I just simply run it, I get:
$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Whenever I try to start the server, I get
$ mysql.server start
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/myhost.pid).
Combined instruction from https://stackoverflow.com/a/5140849/4189299 and https://stackoverflow.com/a/34840101 do not work.
That means, nothing changes after I run
unset TMPDIR
mysqld -initialize --verbose --user=whoami --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
If I try to start the safe mode, it terminates immediately:
$ sudo mysqld_safe start
2016-04-07T13:31:41.6NZ mysqld_safe Logging to '/usr/local/var/mysql/myhost.err'.
2016-04-07T13:31:41.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2016-04-07T13:31:42.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/myhost.pid ended
Please, help me to start MySQL
EDIT:
$ ls /var/log/mysql*
ls: /var/log/mysql*: No such file or directory
EDIT 2:
The PID file actually does not exist:
$ rm /usr/local/var/mysql/myhost.pid
rm: /usr/local/var/mysql/myhost.pid: No such file or directory