First and foremost, I am using Lion and running all latest updates as of today.
I restarted my desktop system over the weekend as a usual practice. Then this morning I realized my local website isn’t working. Further tracking leads to MySQL not starting successfully. You can see the red text in the MySQL System Preference. Clicking on “Start MySQL Server” won’t help.
At this point, ask yourself if you are using my.cnf. Usually, you don’t have to. But if you ever need to do any customization, you probably have copied this file over to /etc. If this applies to you, keep reading. Otherwise this fix may not apply to you.
Do a “sudo mysqld_safe”. You will see something like the following:
my_osx:/tmp bchan$ sudo mysqld_safe Password: 110926 11:08:31 mysqld_safe Logging to '/usr/local/mysql/data/my_osx.err'. 110926 11:08:31 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data 110926 11:08:32 mysqld_safe mysqld from pid file /usr/local/mysql/data/my_osx.pid ended
Opening up the error file “/usr/local/mysql/data/my_osx.err” will give you a clue.
110926 11:22:53 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data 110926 11:22:53 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive /usr/local/mysql/bin/mysqld: File './mysql-bin.index' not found (Errcode: 13) 110926 11:22:53 [ERROR] Aborting 110926 11:22:53 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete 110926 11:22:53 mysqld_safe mysqld from pid file /usr/local/mysql/data/my_osx.pid ended
We caught it. It’s this: “/usr/local/mysql/bin/mysqld: File ‘./mysql-bin.index’ not found (Errcode: 13)”
What the heck is “mysql-bin.index“? Yea, whatever, I never asked for it. Now, open up your /etc/my.cnf file, search for “log-bin=mysql-bin” and “binlog_format=mixed“, then comment them out.
# Replication Master Server (default) # binary logging is required for replication #log-bin=mysql-bin # binary logging format - mixed recommended #binlog_format=mixed
If you really want to enable this whatever you call it, read more at: http://www.linuxquestions.org/questions/linux-software-2/mysqld-var-log-mysql-mysql-bin-index-not-found-480676/
Also, uncomment the InnoDB lines if you are using InnoDB tables.
Then now, restart your osx. Yup, restart your osx. Then hopefully MySQL will start successfully at startup.