Tuesday, April 26, 2011

Upgrade of MySQL 5.1 to 5.5 on Mac OS X

I recently upgraded my existing MySQL 5.1 instance to 5.5 on my Mac (Mac OS X 10.6.7).  On my first try MySQL would not start after the upgrade.  I received the error '/usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist'.

After some Web searching I found that I had run into the same exact issues identified by this MySQL bug.  The last comment was the key to my being able to successfully upgrade MySQL: use the my.cnf template files distributed with the MySQL 5.5 version.

I've upgraded twice, just to make sure the solution worked.  Here is what I did:

1) shutdown the MySQL 5.1 instance: sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
2) rename the existing my.cnf file (one may not exist): sudo mv /etc/my.cnf /etc/my.cnf.51
3) download and install MySQL 5.5: I used the DMG distribution, running mysql-5.5.11-osx10.6-x86_64.pkg first, MySQLStartupItem.pkg second, MySQL.prefPane third.
4) copied the MySQL 5.5 my-large.cnf file into /etc: sudo cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf
5) started MySQL 5.5: sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
6) tested the installation: mysql -u root

MySQL Uninstall:
When I tried the second upgrade I had to uninstall MySQL 5.5.  To do this I did the following:

1) delete MySQL install directories: sudo rm -rf /usr/local/mysql
2) delete Mac receipt files: sudo rm -f /private/var/db/receipts/com.mysql*

1 comment:

  1. Couple points, they are:

    -before upgrading, backup the old db files with
    mysqldump --all-databases > backup_of_5.1.sql
    -after upgrade to 5.5 restore the the backup file
    mysql -u root < backup_of_5.1.sql
    -then run the mysql_upgrade command found in /usr/local/mysql_version/bin to fix permission errors that are common after the upgrade.

    ReplyDelete