Create a gist now

Instantly share code, notes, and snippets.

Embed
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
@pedro-santiago

This comment has been minimized.

Show comment
Hide comment
@pedro-santiago

pedro-santiago Apr 11, 2017

This guide is written having in mind MAMP 4.1.1 and MySQL 5.6. It considers known bugs from 5.6 and also a bunch of suggestions from other Gists.

Owner

pedro-santiago commented Apr 11, 2017

This guide is written having in mind MAMP 4.1.1 and MySQL 5.6. It considers known bugs from 5.6 and also a bunch of suggestions from other Gists.

@Avokaado

This comment has been minimized.

Show comment
Hide comment
@Avokaado

Avokaado Apr 12, 2017

Hi,
i'm trying to upgrade mysql 5.6 to 5.7 using MAMP 4.1.1 and i'm still getting error message

Building Mysql 5.7 Folder
Fixing Access (workaround)
Starting MySQL
170412 16:26:28 mysqld_safe error: log-error set to '/Applications/MAMP/logs/mysql_error_log.err', however file don't exists. Create writable for user 'mysql'.
Migrate, finaly, to new version
mysql_upgrade: [Warning] Using a password on the command line interface can be insecure.
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2) while connecting to the MySQL server
Upgrade process encountered error and will not continue.

So there still is some problem with MySQL socket...
any help is greatly appreciated

Hi,
i'm trying to upgrade mysql 5.6 to 5.7 using MAMP 4.1.1 and i'm still getting error message

Building Mysql 5.7 Folder
Fixing Access (workaround)
Starting MySQL
170412 16:26:28 mysqld_safe error: log-error set to '/Applications/MAMP/logs/mysql_error_log.err', however file don't exists. Create writable for user 'mysql'.
Migrate, finaly, to new version
mysql_upgrade: [Warning] Using a password on the command line interface can be insecure.
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2) while connecting to the MySQL server
Upgrade process encountered error and will not continue.

So there still is some problem with MySQL socket...
any help is greatly appreciated

@vinachang

This comment has been minimized.

Show comment
Hide comment
@vinachang

vinachang Apr 18, 2017

I've got the same issue as Avokaado. After running the script, I can't even start mysql server with MAMP.

I've got the same issue as Avokaado. After running the script, I can't even start mysql server with MAMP.

@Avokaado

This comment has been minimized.

Show comment
Hide comment
@Avokaado

Avokaado Apr 21, 2017

I "solved" this by installing MySQL 5.7 on Ubuntu server on Virtualbox and using MAMPs Apache & PHP only.

Avokaado commented Apr 21, 2017

I "solved" this by installing MySQL 5.7 on Ubuntu server on Virtualbox and using MAMPs Apache & PHP only.

@efriandika

This comment has been minimized.

Show comment
Hide comment
@efriandika

efriandika May 11, 2017

Hi @Avokaado and @vinachang
I have same problem. But, it works for me now..
The problem is in /Applications/MAMP/db/mysql57/ permission
Set permission of /Applications/MAMP/db/mysql57/ as is to mysql56 permission

or

remove sudo chmod -R o+rw /Applications/MAMP/db/mysql57/ from migrate.sh file above

efriandika commented May 11, 2017

Hi @Avokaado and @vinachang
I have same problem. But, it works for me now..
The problem is in /Applications/MAMP/db/mysql57/ permission
Set permission of /Applications/MAMP/db/mysql57/ as is to mysql56 permission

or

remove sudo chmod -R o+rw /Applications/MAMP/db/mysql57/ from migrate.sh file above

@julian-tr

This comment has been minimized.

Show comment
Hide comment
@julian-tr

julian-tr May 17, 2017

I had the same problem with the permissions of the /Applications/MAMP/db/mysql57/folder being incorrect, stopping the MySQL server from starting up.

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.

I had the same problem with the permissions of the /Applications/MAMP/db/mysql57/folder being incorrect, stopping the MySQL server from starting up.

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.

@slamorte

This comment has been minimized.

Show comment
Hide comment
@slamorte

slamorte Jul 26, 2017

There is a problem with this script and MAMP PRO. MAMP and MAMP PRO share almost all their paths, but MAMP PRO recently moved the data directory from /Applications/MAMP/db/ to /Library/Application\ Support/appsolute/MAMP\ PRO/db/. So the "Building Mysql 5.7 Folder" section will not be operating on the right folders.

Furthermore the /Applications/MAMP/Library/bin/mysqld_safe file in MAMP will reference DATADIR=/Applications/MAMP/db/mysql57, which means MAMP PRO on next launch will look for the databases in the old MAMP location.

So if you follow these instructions with MAMP PRO you will probably break your MAMP. MySQL will fail to launch because the data folder is empty. To fix this problem use the following commands:

sudo cp -r /Library/Application\ Support/appsolute/MAMP\ PRO/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/
sudo chmod -R o+rw /Applications/MAMP/tmp/mysql/

Now you can use the Starting MySQL command. It's running for me, though the update script is throwing a ton of errors, that's a problem to fix for later.

There is a problem with this script and MAMP PRO. MAMP and MAMP PRO share almost all their paths, but MAMP PRO recently moved the data directory from /Applications/MAMP/db/ to /Library/Application\ Support/appsolute/MAMP\ PRO/db/. So the "Building Mysql 5.7 Folder" section will not be operating on the right folders.

Furthermore the /Applications/MAMP/Library/bin/mysqld_safe file in MAMP will reference DATADIR=/Applications/MAMP/db/mysql57, which means MAMP PRO on next launch will look for the databases in the old MAMP location.

So if you follow these instructions with MAMP PRO you will probably break your MAMP. MySQL will fail to launch because the data folder is empty. To fix this problem use the following commands:

sudo cp -r /Library/Application\ Support/appsolute/MAMP\ PRO/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/
sudo chmod -R o+rw /Applications/MAMP/tmp/mysql/

Now you can use the Starting MySQL command. It's running for me, though the update script is throwing a ton of errors, that's a problem to fix for later.

@slamorte

This comment has been minimized.

Show comment
Hide comment
@slamorte

slamorte Jul 26, 2017

WARNING: Because this script only backs up the MAMP folder and not the MAMP PRO folder, it will not make backups of your databases.

I've just found that out the hard way.

WARNING: Because this script only backs up the MAMP folder and not the MAMP PRO folder, it will not make backups of your databases.

I've just found that out the hard way.

@david-meza

This comment has been minimized.

Show comment
Hide comment
@david-meza

david-meza Aug 7, 2017

I was able to get it working by copying the folder as @julian-tr suggested and then running the last line in the gist.
The only other issue I had was that I couldn't use mysql from the command line because it was trying to access the mysql socket in a different directory (ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock')
So I also had to run this to update the conf file:
/Applications/MAMP/Library/bin/mysql_config_editor --verbose set --socket=/Applications/MAMP/tmp/mysql/mysql.sock

I was able to get it working by copying the folder as @julian-tr suggested and then running the last line in the gist.
The only other issue I had was that I couldn't use mysql from the command line because it was trying to access the mysql socket in a different directory (ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock')
So I also had to run this to update the conf file:
/Applications/MAMP/Library/bin/mysql_config_editor --verbose set --socket=/Applications/MAMP/tmp/mysql/mysql.sock

@imtiazwazir

This comment has been minimized.

Show comment
Hide comment
@imtiazwazir

imtiazwazir Aug 27, 2017

@david-meza solution worked for me 👍

@david-meza solution worked for me 👍

@SeanCannon

This comment has been minimized.

Show comment
Hide comment
@SeanCannon

SeanCannon Sep 4, 2017

@david-meza solution also worked for me. Can't believe 5.7 still isn't provided in the MAMP core though. Also it should be noted that after you run the upgrade you need to restart the mysql server or else you'll get information_schema errors when you run queries. You can repro this by opening phpmyadmin, selecting any table and clicking the Browse button. Restarting fixes that.

@david-meza solution also worked for me. Can't believe 5.7 still isn't provided in the MAMP core though. Also it should be noted that after you run the upgrade you need to restart the mysql server or else you'll get information_schema errors when you run queries. You can repro this by opening phpmyadmin, selecting any table and clicking the Browse button. Restarting fixes that.

@georgios-2317

This comment has been minimized.

Show comment
Hide comment
@georgios-2317

georgios-2317 Sep 13, 2017

Couldn't get it to upgrade and when a new MAMP (PRO) release came it crapped all over my efforts. Instead following their instructions and installing a separate copy of MySQL : https://documentation.mamp.info/en/MAMP-PRO-Mac/How-Tos/MySQL/InstallMySQL57/

Couldn't get it to upgrade and when a new MAMP (PRO) release came it crapped all over my efforts. Instead following their instructions and installing a separate copy of MySQL : https://documentation.mamp.info/en/MAMP-PRO-Mac/How-Tos/MySQL/InstallMySQL57/

@omatrot

This comment has been minimized.

Show comment
Hide comment
@omatrot

omatrot Oct 5, 2017

Well, starting mysql fails almost silently with the following:

171005 10:41:42 mysqld_safe Logging to '/Applications/MAMP/logs/mysql_error_log.err'.
171005 10:41:42 mysqld_safe Starting mysqld daemon with databases from /Applications/MAMP/db/mysql57
171005 10:41:42 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended

The mysql_error_log.err file is empty.
There is no other mysqld process running.
Is there a way to see why it is failing ?

omatrot commented Oct 5, 2017

Well, starting mysql fails almost silently with the following:

171005 10:41:42 mysqld_safe Logging to '/Applications/MAMP/logs/mysql_error_log.err'.
171005 10:41:42 mysqld_safe Starting mysqld daemon with databases from /Applications/MAMP/db/mysql57
171005 10:41:42 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended

The mysql_error_log.err file is empty.
There is no other mysqld process running.
Is there a way to see why it is failing ?

@omatrot

This comment has been minimized.

Show comment
Hide comment
@omatrot

omatrot Oct 5, 2017

Solved the problem with a nasty:

sudo chmod -R 777 /Applications/MAMP/db/mysql57

I do not understand which user the mysqld process is running from...

omatrot commented Oct 5, 2017

Solved the problem with a nasty:

sudo chmod -R 777 /Applications/MAMP/db/mysql57

I do not understand which user the mysqld process is running from...

@matyhaty

This comment has been minimized.

Show comment
Hide comment
@matyhaty

matyhaty Oct 17, 2017

I needed to install wget on my osx

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew install wget --with-libressl

Other than that, worked fine. Using Mamp Pro 4.1.1

I needed to install wget on my osx

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew install wget --with-libressl

Other than that, worked fine. Using Mamp Pro 4.1.1

@aaronmarton

This comment has been minimized.

Show comment
Hide comment
@aaronmarton

aaronmarton Nov 9, 2017

@david-meza, best solution!

@david-meza, best solution!

@jamoralesr

This comment has been minimized.

Show comment
Hide comment
@jamoralesr

jamoralesr Nov 24, 2017

@david-meza, excelente!!!

@david-meza, excelente!!!

@kossa

This comment has been minimized.

Show comment
Hide comment
@kossa

kossa Feb 11, 2018

Just tried Mamp pro 4.4 with the latest version : https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.21-macos10.13-x86_64.tar.gz

And works fine :D

image

kossa commented Feb 11, 2018

Just tried Mamp pro 4.4 with the latest version : https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.21-macos10.13-x86_64.tar.gz

And works fine :D

image

@gyan111

This comment has been minimized.

Show comment
Hide comment
@gyan111

gyan111 Feb 14, 2018

Failed for me.

zsh: no matches found: /Applications/MAMP/db/mysql57/mysql/innodb_*
zsh: no matches found: /Applications/MAMP/db/mysql57/mysql/slave_*

And when I run migrate

mysql_upgrade: [Warning] Using a password on the command line interface can be insecure.
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2) while connecting to the MySQL server
Upgrade process encountered error and will not continue.

gyan111 commented Feb 14, 2018

Failed for me.

zsh: no matches found: /Applications/MAMP/db/mysql57/mysql/innodb_*
zsh: no matches found: /Applications/MAMP/db/mysql57/mysql/slave_*

And when I run migrate

mysql_upgrade: [Warning] Using a password on the command line interface can be insecure.
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2) while connecting to the MySQL server
Upgrade process encountered error and will not continue.

@redesigned

This comment has been minimized.

Show comment
Hide comment
@redesigned

redesigned Feb 18, 2018

Anyone try upgrading MAMP after this process and fixing things?
I'd love to see a GIST for that process before I potentially break MAMP upgrades.

Anyone try upgrading MAMP after this process and fixing things?
I'd love to see a GIST for that process before I potentially break MAMP upgrades.

@evolot

This comment has been minimized.

Show comment
Hide comment
@evolot

evolot May 15, 2018

work fine!thanks

evolot commented May 15, 2018

work fine!thanks

@kossa

This comment has been minimized.

Show comment
Hide comment
@kossa

kossa May 29, 2018

It works fine mamp 4.5

kossa commented May 29, 2018

It works fine mamp 4.5

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