Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Upgrade MAMP 4 to Mysql 5.7.18 (on Sierra tested)
#!/bin/sh
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18-macos10.12-x86_64.tar.gz
tar xfvz mysql-5.7.18-macos10.12-x86_64.tar.gz
echo "Stopping MAMP"
sudo /Applications/MAMP/bin/stop.sh
sudo killall httpd mysqld
echo "Copy Bin"
sudo rsync -arv --progress mysql-5.7.*/bin/* /Applications/MAMP/Library/bin/ --exclude=mysqld_multi --exclude=mysqld_safe
echo "Copy Share"
sudo rsync -arv --progress mysql-5.7.*/share/* /Applications/MAMP/Library/share/
echo "Building Mysql 5.7 Folder"
sudo cp -r /Applications/MAMP/db/mysql56 /Applications/MAMP/db/mysql57
sudo rm -fr /Applications/MAMP/db/mysql57/mysql/innodb_*
sudo rm -fr /Applications/MAMP/db/mysql57/mysql/slave_*
sudo chmod -R o+rw /Applications/MAMP/db/mysql57/
sed -i.bak 's/mysql56/mysql57/g' /Applications/MAMP/Library/bin/mysqld_safe
echo "Fixing Access (workaround)"
sudo chmod -R o+rw /Applications/MAMP/tmp/mysql/
echo "Starting MySQL"
sudo /Applications/MAMP/Library/bin/mysqld_safe --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log
echo "Migrate, finaly, to new version"
sudo /Applications/MAMP/Library/bin/mysql_upgrade --user=root --password=root --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --force
@kossa
Copy link

kossa commented May 29, 2018

It works fine mamp 4.5

@philsam
Copy link

philsam commented Jul 26, 2018

@julian-tr 's solution above worked for me

My solution was to simply duplicate the mysql56 folder in the Finder, rename the copy to mysql57 and start MAMP. It then offers to upgrade the databases for you.

@ronappleton
Copy link

ronappleton commented Aug 12, 2018

If it helps I used the following:

#!/bin/sh

echo "Getting MYsql 5.7"
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.23-macos10.13-x86_64.tar.gz
tar xfvz mysql-5.7.23-macos10.13-x86_64.tar.gz

echo "Stopping MAMP"
sudo /Applications/MAMP/bin/stop.sh
sudo killall httpd mysqld

echo "Copy Bin"
sudo rsync -arv --progress mysql-5.7.*/bin/* /Applications/MAMP/Library/bin/ --exclude=mysqld_multi --exclude=mysqld_safe

echo "Copy Share"
sudo rsync -arv --progress mysql-5.7.*/share/* /Applications/MAMP/Library/share/

echo "Building Mysql 5.7 Folder"
sudo cp -r /Applications/MAMP/db/mysql56 /Applications/MAMP/db/mysql57
sudo rm -fr /Applications/MAMP/db/mysql57/mysql/innodb_*
sudo rm -fr /Applications/MAMP/db/mysql57/mysql/slave_*
sudo chmod -R 0777  /Applications/MAMP/db/mysql57/
sed -i.bak 's/mysql56/mysql57/g' /Applications/MAMP/Library/bin/mysqld_safe

echo "Fixing Access (workaround)"
sudo chmod -R o+rw  /Applications/MAMP/tmp/mysql/

echo "Updating MAMP socket"
sudo /Applications/MAMP/Library/bin/mysql_config_editor --verbose set --socket=/Applications/MAMP/tmp/mysql/mysql.sock

echo "Starting MySQL"
sudo /Applications/MAMP/Library/bin/mysqld_safe --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log

echo "Migrate, finaly, to new version"
sudo /Applications/MAMP/Library/bin/mysql_upgrade --user=root --password=local --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --force

@jonasvanderhaegen
Copy link

jonasvanderhaegen commented Mar 29, 2019

@ronappleton 's code works fine for me. Thanks man!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment