Skip to content

Instantly share code, notes, and snippets.

@ClaudioVarandas
Forked from pjmazenot/migrate-mamp-to-mysql-5.7.sh
Created September 16, 2016 23:10
Show Gist options
  • Save ClaudioVarandas/c1a9617722f62f400a49bdf29e0d2e9e to your computer and use it in GitHub Desktop.
Save ClaudioVarandas/c1a9617722f62f400a49bdf29e0d2e9e to your computer and use it in GitHub Desktop.
Upgrade MAMP 3.5 to MySQL 5.7 tested 2016/09/17
#!/bin/sh
# Original by Ken Lin
# Updated by Pierre-Julien Mazenot
#
# - Mysql version 5.7.9 -> 5.7.11
# - Comments
#
# Additional notes after last tests
#
# - Error wget (’wget’ is not recognized as an internal or external command, operable program or batch file.)
# Install wget using homebrew: "brew install wget"
# - Error rsync (rsync error: some files could not be transferred)
# Delete the archive and the decompress folder and rerun the script
# - Error mysql_upgrade (2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock')
# Re-run only the last line of this script
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.11-osx10.10-x86_64.tar.gz
tar xfvz mysql-5.7*
echo "stopping mamp"
sudo /Applications/MAMP/bin/stop.sh
sudo killall httpd mysqld
echo "creating backup"
sudo rsync -a /Applications/MAMP ~/Desktop/MAMP-Backup
echo "copy bin"
sudo rsync -av mysql-5.7.*/bin/* /Applications/MAMP/Library/bin/ --exclude=mysqld_multi --exclude=mysqld_safe
echo "copy share"
sudo rsync -av mysql-5.7.*/share/* /Applications/MAMP/Library/share/
echo "fixing access (workaround)"
sudo chmod -R o+rw /Applications/MAMP/db/mysql/
sudo chmod -R o+rw /Applications/MAMP/tmp/mysql/
echo "starting mamp"
ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
sudo /Applications/MAMP/bin/start.sh
echo "migrate to new version"
sudo chmod -R 777 /Applications/MAMP/db/mysql/
/Applications/MAMP/Library/bin/mysql_upgrade --user=root --password=root --host=localhost --port=3306
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment