Updating mysql for Drupal 8

As Drupal 8 now required a mysql version higher then my current manually installed version 5.1.46 released on April 23, 2010 I have to try yo get rid of that version and install the latest through homebrew.

brew install mysql
==> Downloading https://homebrew.bintray.com/bottles/mysql-5.6.23.mavericks.bottle.tar.gz
==> Pouring mysql-5.6.23.mavericks.bottle.tar.gz
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.

To connect:
    mysql -uroot

To have launchd start mysql at login:
    ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents

Then to load mysql now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

Or, if you don't want/need launchctl, you can just run:
    mysql.server start
==> /usr/local/Cellar/mysql/5.6.23/bin/mysql_install_db --verbose --user=clemens --basedir=/usr/local/Cellar/mysql/5.6.23 --datadir=/usr/local/var/mysql --tmpdir=/tmp
2015-05-10 18:04:30 1247 [Note] InnoDB: FTS optimize thread exiting.
2015-05-10 18:04:30 1247 [Note] InnoDB: Starting shutdown...
2015-05-10 18:04:31 1247 [Note] InnoDB: Shutdown completed; log sequence number 1600607
2015-05-10 18:04:31 1247 [Note] /usr/local/Cellar/mysql/5.6.23/bin/mysqld: Shutdown complete

Warning: The post-install step did not complete successfully
You can try again using `brew postinstall mysql`
==> Summary
 /usr/local/Cellar/mysql/5.6.23: 9687 files, 339M

How did I start mysql in 2010?

Fortunate I blogged about this.

# Stop the old
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop

# Move config out of the way
sudo mv /etc/my.cnf /etc/my.cnf-5.1

brew postinstall mysql

mysql.server start

# Do I have the correct version now?
mysql -V

/usr/local/Cellar/mysql/5.6.23/bin/mysql -uroot

mysql.server stop

Now copy over a database to make sure the upgrade path works on the old databases.

sudo cp -r /usr/local/mysql/data/drupal_d7 /usr/local/var/mysql/
sudo chown -R clemens  /usr/local/var/mysql/drupal_d7/

Database is available?

You will note the databases are not compatible with latest version.

$ mysql -uroot
mysql> use drupal_d7;
mysql> show tables;
mysql> select * from task;
ERROR 1146 (42S02): Table 'drupal_d7.task' doesn't exist

According to http://www.linux.org/threads/resolving-mysql-error-1146-table-doesnt-exist-when-doing-backup.2480/ quickest resolution is drop your database and import so that's what I'll have to do. To bad.

So I recreated all databases and imported through drush.

Make it permanent

mysql.server stop
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
mysql.server start

Restart computer

check logout / login ... I completely forgot this step which proved vital the other day. My mac crashed so a reboot was eminent. And next the old mysql started.

Remove the old code


Remove old mysql-bin.00xxxx

I had 160GB of these mysql-bin files.

cd /usr/local/mysql/data
du -g -s -c mysql-bin.*
160 total

rm mysql-bin.000*