Skip to content

Instantly share code, notes, and snippets.

@pepijnblom
Forked from tobi-pb/migrate.sh
Last active November 18, 2020 22:20
Show Gist options
  • Star 33 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save pepijnblom/dcccad436bbadcf63867 to your computer and use it in GitHub Desktop.
Save pepijnblom/dcccad436bbadcf63867 to your computer and use it in GitHub Desktop.
Upgrade MAMP to Mysql 5.7
#!/bin/sh
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.15-osx10.11-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 -arv --progress /Applications/MAMP ~/Desktop/MAMP-Backup
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 "fixing access (workaround)"
sudo chmod -R o+rw /Applications/MAMP/db/mysql/
sudo chmod -R o+rw /Applications/MAMP/tmp/mysql/
sudo chmod -R o+rw "/Library/Application Support/appsolute/MAMP PRO/db/mysql/"
echo "starting mamp"
sudo /Applications/MAMP/bin/start.sh
echo "making symlink, enter sudo password"
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
echo "migrate to new version"
/Applications/MAMP/Library/bin/mysql_upgrade -u root --password=root -h 127.0.0.1
@piotrekkaminski
Copy link

The last command fails and needs --socket=/Applications/MAMP/tmp/mysql/mysql.sock (maybe only on recent MAMP versions)

@kunicmarko20
Copy link

kunicmarko20 commented Oct 26, 2016

Had this problem :

migrate to new version
mysql_upgrade: [Warning] Using a password on the command line interface can be insecure.
mysql_upgrade: Got error: 2003: Can't connect to MySQL server on '127.0.0.1' (61) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended

This fixed it :

sudo chmod -R 777 /Applications/MAMP/db/mysql/
/Applications/MAMP/Library/bin/mysql_upgrade --user=root --password=root --host=localhost --port=3306

@bradhill929
Copy link

Failing to start MySQL when you run MAMP PRO after system restart. (I am using macOS Sierra.)

System restart cleaned up /tmp and I had to run sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock to start MAMP PRO after each restart of my Mac.

Any idea why I have to run sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock each time? Normal MAMP PRO never do that.

Upgrading to Mysql 5.6 following http://blog-en.mamp.info/2015/07/how-to-use-mysql-5-6-with-mamp-and-mamp.html never required it.

@Serhioromano
Copy link

/Applications/MAMP/Library/bin/mysql_upgrade --user=root --password=root --host=localhost --port=3306 Did not work for me. And sudo chmod -R 777 /Applications/MAMP/db/mysql/ also because it is actualy a sudo chmod -R 777 /Applications/MAMP/db/mysql56/

But after launching MAMP app it asked to upgrade MySQL and it runned upgrade ok.

@ava-cassiopeia
Copy link

Worked well for me, thanks!

@Kvartir54
Copy link

Kvartir54 commented Feb 9, 2017

Doesn't work for me.
I am using macOS Sierra and MAMP Pro 4.

@coding-sunshine
Copy link

@Kvartir54 did u manage to make it work for MAMP Pro 4?

@deweydb
Copy link

deweydb commented Apr 1, 2017

A lot of MAMP crashes later, and some keyboard bashing and lots of combinations of the suggestions here, did eventually get this working with MAMP Pro 4. so it is possible. i did lose my databases in the progress, so you might want to back those up first.

@maggiefor
Copy link

Also didn't work for me.
I got this error Error: Failed while fetching Server version! Could be due to unauthorized access.

@pedro-santiago
Copy link

Hi guys, I've created a new Gist for version 4.1.1 of MAMP and migrating from MySQL 5.6 : https://gist.github.com/pedro-santiago/0d23167e50f95489103507725bb0fb14

Hope it helps someone ;)

@Avokaado
Copy link

@deweydb How did you manage to make it work?

@lkddi
Copy link

lkddi commented Mar 8, 2018

180308 13:33:58 mysqld_safe Logging to '/Applications/MAMP/logs/mysql_error.log'.
180308 13:33:58 mysqld_safe Starting mysqld daemon with databases from /Library/Application Support/appsolute/MAMP PRO/db/mysql56
2018-03-08T05:33:58.996372Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-03-08T05:33:58.998237Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2018-03-08T05:33:58.999395Z 0 [Note] /Applications/MAMP/Library/bin/mysqld (mysqld 5.7.15) starting as process 12828 ...
2018-03-08T05:33:59.014396Z 0 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql56/ is case insensitive
2018-03-08T05:33:59.026015Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-03-08T05:33:59.026112Z 0 [Note] InnoDB: Uses event mutexes
2018-03-08T05:33:59.026133Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-03-08T05:33:59.026151Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-03-08T05:33:59.028890Z 0 [Note] InnoDB: Number of pools: 1
2018-03-08T05:33:59.031586Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-03-08T05:33:59.033383Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-03-08T05:33:59.052874Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-03-08T05:33:59.069695Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-03-08T05:33:59.072734Z 0 [ERROR] InnoDB: Upgrade after a crash is not supported. This redo log was created before MySQL 5.7.9, and it appears corrupted. Please follow the instructions at http://dev.mysql.com/doc/refman/5.7/en/upgrading.html
2018-03-08T05:33:59.072808Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2018-03-08T05:33:59.382788Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2018-03-08T05:33:59.382870Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-03-08T05:33:59.382907Z 0 [ERROR] Failed to initialize plugins.
2018-03-08T05:33:59.382932Z 0 [ERROR] Aborting

2018-03-08T05:33:59.382978Z 0 [Note] Binlog end
2018-03-08T05:33:59.386145Z 0 [Note] Shutting down plugin 'CSV'
2018-03-08T05:33:59.390433Z 0 [Note] /Applications/MAMP/Library/bin/mysqld: Shutdown complete

180308 13:33:59 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended

@macOneOone
Copy link

macOneOone commented Apr 27, 2018

Hey thanks... for works perfectly on macOS High Sierra using this command at the end

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

@JefferyHus
Copy link

I get broken pipe error wow

@fabiotnt
Copy link

If possible, check if wget is present on MacOS machine. ;)

Great script

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