MySql Hell: error! the server quit without updating pid file

First I have to note that several other developers have recommended removing the .err file, or renaming the ib_logfile## files. Obviously this didn't work for me or else I wouldn't be writing this post.


This issue started occurring once I placed my.cnf into the /etc directory.

The best way to see what's actually happen is to open the err file and debug. You can specify the location of the log file via:

[mysqld]
datadir = /usr/local/mysql

With the above setting, your log file will be:
/usr/local/mysql/.err



In my case it was actually a permissions issue. My database uses a non-standard socket setting (to match linux environment). I also disabled the root access, and have specific credentials that mysqld and mysql needs during startup. That said, my my.cnf file looks as follows:

[client]
user=myuser
password=mypassword

[mysqld]
user=sysuser
pid-file=/path/to/mysqld.pid
socket=/path/to/mysqld.sock
port=3306
datadir=/dir/for/mysql/data
tmpdir=/tmp
general_log_file=/tmp/logs/mysql.log
log_bin=/tmp/logs/mysql-bin.log
# DO NOT USE THIS NEXT LINE OR YOUR DB WILL BE LOCKED IN READ ONLY MODE
# innodb_force_recovery = 1


It's important to note that sysuser is actually the user who OWNS the directories on your system (ie. root or yourMacUserName), not to be confused with your mysql users. So, in my case, I would also need to make sure that the datadir, pid-file-dir, socket-dir, and log-dir are all accessible (via chown) by 'sysuser'.


now try starting the db via: sudo mysql.server start

No comments: