Jan 13, 2014

Mac OS X MySQL problems

Note: I'm running a brew installation of mysql on Mac OS X Mavericks.

First of all learn how to debug the mysql errors. Usually a tail -f /usr/local/var/mysql/*.err does the trick.

Common problems

Corrupt InnoDB files

2014-01-13 17:32:09 6124 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2014-01-13 17:32:09 6124 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
This problem is usually caused by a corrupted innodb logfile. There files are located in /usr/local/var/mysql and have a "ib" prefix filename (in my case they are named ib_logfile0, ib_logfile1 and ibdata1).
  1. Backup the ib files: mv /usr/local/var/mysql/ib* ~/Desktop/ib_files/
  2. Stop mysqld processes; ps xua | grep mysql, and then: kill -9 PID
  3. Restart the mysql server: mysql.server restart

Bad Permissions

Fatal error: Can't open privilege tables: Can't find file: './mysql/host.frm' (errno: 13)

Possible solution:
sudo chown -R _mysql /usr/local/var/mysql

Errors after brew upgrades

After a brew upgrade that affects MySQL you should reload it:

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

No comments:

Post a Comment