Upgrade MySQL Database from 5.5 to 5.6 on macOS 10.8 Mountain Lion

MySQL version 5.6.14 is available for download for OSX, a double click and install is available named Mac OS X ver. 10.7 (x86, 64-bit), DMG Archive. (Don’t worry about the 10.7 naming, Works fine in OSX 10.9 and OSX 10.8)

Stop the MySQL Server

sudo /usr/local/mysql/support-files/mysql.server stop

Download and Launch the DMG

There is no upgrade option in the installer and you are presented with the 3 installations:

Mysql Update Osx

You need to install all the three installers.

Control/Right click the mysql-5.6…pkg to avoid the security GateKeeper. Follow the installation processes.

Location of MySQL 5.6 Data

MySQL data and files will be stored at:

/usr/local/mysql-5.6.14-osx10.7-x86_64

and an ‘mysql’ directory alias is also created that points to the same location

/usr/local/mysql

which points to 

mysql -> mysql-5.6.14-osx10.7-x86_64

Your previous installation is maintained and will be filed in the same location with the appropraite version you were using, like so:

/usr/local/mysql-5.5.13-osx10.6-x86_6

What needs to be done is to migrate the database and tables to the new version.

Migrate Databases

The key directory from the previous instance that needs to be copied is :

/usr/local/mysql-5.5.13-osx10.6-x86_64/data

So in this instance the previous mysql version was 5.5.13 – rename the new data directory and copy in the old one and fix file ownership to MySQL:

Change Name of newer data directory
sudo mv /usr/local/mysql-5.6.14-osx10.7-x86_64/data /usr/local/mysql-5.6.14-osx10.7-x86_64/dataold
Copy Old Databases into new location
sudo cp -rf /usr/local/mysql-5.5.13-osx10.6-x86_64/data /usr/local/mysql-5.6.14-osx10.7-x86_64/
Set Correct Ownership to MySQL
sudo chown -R _mysql /usr/local/mysql-5.6.14-osx10.7-x86_64/data

Start MySQL and Repair

Now we need to start the MySQL database and run a repair/upgrade tool on the older databases

sudo /usr/local/mysql/support-files/mysql.server start
Run the Upgrade Tool
/usr/local/mysql/bin/mysql_upgrade

If you get errors on the first run, run the command again

Restart MySQL
sudo /usr/local/mysql/support-files/mysql.server restart
Check the Version
/usr/local/mysql/bin/mysql
Set MySQL Password
/usr/local/mysql/bin/mysqladmin -u root password 'yourpasswordhere'
my.cnf

In the latest version of MySQL 5.6 there is a default ‘my.cnf’ file that the database references that is now stored in:

/usr/local/mysql-5.6.14-osx10.7-x86_64/my.cnf

So if you have made any customisations to the behavior of MySQL then these will now need to be added in the new my.cnf file and make a copy to /etc so any global changes will be read in when MySQL is launched.

Leave all Comment