Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Upgrade MAMP to Mysql 5.6
#!/bin/sh
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.24-osx10.9-x86_64.tar.gz
tar xfvz mysql-5.6*
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.6.*/bin/* /Applications/MAMP/Library/bin/ --exclude=mysqld_multi --exclude=mysqld_safe
echo "copy share"
sudo rsync -av mysql-5.6.*/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"
sudo /Applications/MAMP/bin/start.sh
echo "migrate to new version"
/Applications/MAMP/Library/bin/mysql_upgrade -u root --password=root -h 127.0.0.1
@klein0r

This comment has been minimized.

Copy link

klein0r commented Jan 10, 2015

Well done! 😄

Looking for 'mysql' as: /Applications/MAMP/Library/bin/mysql
Looking for 'mysqlcheck' as: /Applications/MAMP/Library/bin/mysqlcheck
FATAL ERROR: Upgrade failed

Solution: Add host to last line: -h 127.0.0.1

@klein0r

This comment has been minimized.

Copy link

klein0r commented Jan 10, 2015

Some cleanup would be nice, too 😜

@tobi-pb

This comment has been minimized.

Copy link
Owner Author

tobi-pb commented Jan 11, 2015

I added -h 127.0.0.1 to last line, thanks.

Cleanup? Sorry, i don't think its a goog idea to delete something automatticly 😄

@scarnago

This comment has been minimized.

Copy link

scarnago commented Jan 14, 2015

Thanks a lot, your script saves my life... worth a million dollars, jejeje

@klein0r

This comment has been minimized.

@rigobertocontreras

This comment has been minimized.

Copy link

rigobertocontreras commented Feb 27, 2015

I included the socket -S /Applications/MAMP/tmp/mysql/mysql.sock

@cfxd

This comment has been minimized.

Copy link

cfxd commented Mar 8, 2015

$ ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock was the missing step for me.

@ChristopherDosin

This comment has been minimized.

Copy link

ChristopherDosin commented Mar 9, 2015

I`m getting this error:

150309 20:43:34 mysqld_safe Starting mysqld daemon with databases from /Library/Application Support/appsolute/MAMP PRO/db/mysql
150309 20:43:34 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
150309 20:43:34 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql/ is case insensitive
150309 20:43:34 [Note] Plugin 'FEDERATED' is disabled.
150309 20:43:34 InnoDB: The InnoDB memory heap is disabled
150309 20:43:34 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150309 20:43:34 InnoDB: Compressed tables use zlib 1.2.3
150309 20:43:34 InnoDB: Initializing buffer pool, size = 128.0M
150309 20:43:34 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
150309 20:43:34 [ERROR] Plugin 'InnoDB' init function returned error.
150309 20:43:34 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
150309 20:43:34 [ERROR] Unknown/unsupported storage engine: InnoDB
150309 20:43:34 [ERROR] Aborting

150309 20:43:34 [Note] /Applications/MAMP/Library/bin/mysqld: Shutdown complete

150309 20:43:34 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
150309 20:55:22 mysqld_safe Starting mysqld daemon with databases from /Library/Application Support/appsolute/MAMP PRO/db/mysql
150309 20:55:22 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
150309 20:55:22 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql/ is case insensitive
150309 20:55:22 [Note] Plugin 'FEDERATED' is disabled.
150309 20:55:22 InnoDB: The InnoDB memory heap is disabled
150309 20:55:22 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150309 20:55:22 InnoDB: Compressed tables use zlib 1.2.3
150309 20:55:22 InnoDB: Initializing buffer pool, size = 128.0M
150309 20:55:22 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
150309 20:55:22 [ERROR] Plugin 'InnoDB' init function returned error.
150309 20:55:22 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
150309 20:55:22 [ERROR] Unknown/unsupported storage engine: InnoDB
150309 20:55:22 [ERROR] Aborting

150309 20:55:22 [Note] /Applications/MAMP/Library/bin/mysqld: Shutdown complete

150309 20:55:22 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
150309 21:05:56 mysqld_safe Starting mysqld daemon with databases from /Library/Application Support/appsolute/MAMP PRO/db/mysql
150309 21:05:56 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
150309 21:05:56 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql/ is case insensitive
150309 21:05:56 [Note] Plugin 'FEDERATED' is disabled.
150309 21:05:56 InnoDB: The InnoDB memory heap is disabled
150309 21:05:56 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150309 21:05:56 InnoDB: Compressed tables use zlib 1.2.3
150309 21:05:56 InnoDB: Initializing buffer pool, size = 128.0M
150309 21:05:56 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
150309 21:05:56 [ERROR] Plugin 'InnoDB' init function returned error.
150309 21:05:56 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
150309 21:05:56 [ERROR] Unknown/unsupported storage engine: InnoDB
150309 21:05:56 [ERROR] Aborting

150309 21:05:56 [Note] /Applications/MAMP/Library/bin/mysqld: Shutdown complete

150309 21:05:56 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended

@cfxd

This comment has been minimized.

Copy link

cfxd commented Mar 15, 2015

The problem is most likely related to not having the sym link. Also, OS X clears the /tmp/ dir after each reboot so you'll need to create it each time you power up. I'm trying to find an easier solution.

@PravyAI

This comment has been minimized.

Copy link

PravyAI commented Mar 16, 2015

Looking for 'mysql' as: /Applications/MAMP/Library/bin/mysql
Looking for 'mysqlcheck' as: /Applications/MAMP/Library/bin/mysqlcheck
FATAL ERROR: Upgrade failed

@PravyAI

This comment has been minimized.

Copy link

PravyAI commented Mar 16, 2015

upgraded but mamp still showing the 5.5 mysql version

@joris-lambrechts

This comment has been minimized.

Copy link

joris-lambrechts commented Apr 9, 2015

Mac OS X 10.10.2 & MAMP 3.0.7.2

Changed a couple of things:

Due to incompatible changes coming from 5.5 I also followed this guide: http://mechanics.flite.com/blog/2014/05/01/upgrading-temporal-columns-from-mysql-5-dot-5-to-mysql-5-dot-6-format/

Thanks for the script!

@goliathuy

This comment has been minimized.

Copy link

goliathuy commented Apr 15, 2015

I have mamp pro and I get the folowing error
httpd: Syntax error on line 132 of /Applications/MAMP/conf/apache/httpd.conf: Cannot load /Applications/MAMP/bin/php/php5.3.5/modules/libphp5.so into server: dlopen(/Applications/MAMP/bin/php/php5.3.5/modules/libphp5.so, 10): image not found

The problem is that it's using the wrong php version, si if I fix it, it goes on, but then I find other set of errors ending with the problem with the tables, the root password etc...
Does any one have experienced this?

@gregorskii

This comment has been minimized.

Copy link

gregorskii commented May 10, 2015

goliathuy, if you are still having the issue (and for anyone else) go to the /Applications/MAMP/conf/apache/httpd.conf file and edit the line to point to the correct php version active:

EX:

LoadModule php5_module /Applications/MAMP/bin/php/php5.6.7/modules/libphp5.so

@kersten

This comment has been minimized.

Copy link

kersten commented May 20, 2015

I had to remove table_cache=64 from my.cnf.

Now mysql starts, but mamp does not recognize it? Why?

@syoumans

This comment has been minimized.

Copy link

syoumans commented Jun 5, 2015

Thanks for this! Removing table_cache from my.cnf and adding the following to mysql_update was necessary in my case:

-S /Applications/MAMP/tmp/mysql/mysql.sock

@dvieregge

This comment has been minimized.

Copy link

dvieregge commented Jun 15, 2015

Got something in the MAMP/logs/mysql_error.log file along the lines of:

[Note] InnoDB: 5.6.24 started; log sequence number XXXXXXXX
[ERROR] /Applications/MAMP/Library/bin/mysqld: unknown variable 'table_cache=64'
ERROR] Aborting

Try:

  1. Start MAMP PRO.
  2. Stop the MAMP Server if it is running.
  3. Select File -> Edit Template -> MySQL my.cnf
  4. goto table_cache=64
  5. Comment it out: #table_cache=64
  6. Close & save at the prompt
  7. Restart MAMP
@BrownSim

This comment has been minimized.

Copy link

BrownSim commented Jun 24, 2015

Me too I have this error
Looking for 'mysql' as: /Applications/MAMP/Library/bin/mysql
Looking for 'mysqlcheck' as: /Applications/MAMP/Library/bin/mysqlcheck
FATAL ERROR: Upgrade failed

@iamphilrae

This comment has been minimized.

Copy link

iamphilrae commented Jun 27, 2015

@BrownSim Try removing the -h 127.0.0.1 from the last line in the gist. It was added because someone else reported a similar problem without it, but I had the problem that you're having with it.

@daancart2quote

This comment has been minimized.

Copy link

daancart2quote commented Jun 30, 2015

Thank you!
I had to replace wget for curl and add a chmod but it in the end it worked.

#!/bin/sh

curl -O http://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.24-osx10.9-x86_64.tar.gz
tar xfvz mysql-5.6*

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.6.*/bin/* /Applications/MAMP/Library/bin/ --exclude=mysqld_multi --exclude=mysqld_safe 

echo "copy share"
sudo rsync -av mysql-5.6.*/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"
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=127.0.0.1 --port=3306

@dvieregge

This comment has been minimized.

Copy link

dvieregge commented Jul 16, 2015

Also, if you have issues on Mac OS X Yosimite 10.10.4 with MAMP rebooting until you:
$ ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
You can:
crontab -e
@reboot ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock

@Galch24

This comment has been minimized.

Copy link

Galch24 commented Jul 23, 2015

It works for me with " -h localhost " in last line.

Thanks!

@s26

This comment has been minimized.

Copy link

s26 commented Aug 5, 2015

awesome script.
ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock was the missing step for me.

@akinyeleolubodun

This comment has been minimized.

Copy link

akinyeleolubodun commented Sep 16, 2015

If you are getting (errno: 13 - Permission denied) error. Run below

sudo chown -R mysql:mysql  /Applications/MAMP/db/mysql/
sudo chown -R mysql:mysql  /Applications/MAMP/tmp/mysql/
@ericcs

This comment has been minimized.

@marcobiedermann

This comment has been minimized.

Copy link

marcobiedermann commented Feb 1, 2016

You could update your script to get the latest version of MySQL (5.7.10)

wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.10-osx10.10-x86_64.tar.gz
@CodingMeSwiftly

This comment has been minimized.

Copy link

CodingMeSwiftly commented Mar 13, 2016

It's not working at all.

Looking for 'mysql' as: /Applications/MAMP/Library/bin/mysql
Looking for 'mysqlcheck' as: /Applications/MAMP/Library/bin/mysqlcheck
FATAL ERROR: Upgrade failed

Is this only working with MAMP Pro?

Update: I stand corrected
It is indeed working. But:
run ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock before doing anything else.
I had to manually execute each statement in the script one after another.
Don't execute the last one. Instead in MAMP: Tools>Upgrade MySQL Databases.

@MartinGPuryear

This comment has been minimized.

Copy link

MartinGPuryear commented Apr 21, 2016

I got here because I wanted the combination of MAMP simplicity (including the choice between latest PHP5.x and PHP7), but with MySQL >= 5.6.5 (so I can set default values for created_at and updated_at).

Ultimately I successfully used daancart2quote's version above, with three changes:

  1. I manually (from UI) downloaded the 5.7.12 version from the website,
  2. I changes the various 5.6* in subsequent steps to 5.7*,
  3. I allowed MAMP to do the upgrade (Tools -> Upgrade Databases), from the MAMP UI (you will need to do "sudo chmod -R 777 /Applications/MAMP/db/mysql/" yourself).

Hopefully this is helpful to others.

@billforward-alex

This comment has been minimized.

Copy link

billforward-alex commented Oct 14, 2016

If you encounter during the mysql_upgrade step the following error:

(errno: 13 - Permission denied)

You can fix this by changing the ownership of the mysql directory:

sudo chown -R _mysql:_mysql /Applications/MAMP/db/mysql
@tim-peters

This comment has been minimized.

Copy link

tim-peters commented Nov 18, 2016

Is there anything similar for the windows version of MAMP?

@kevinlui1109

This comment has been minimized.

Copy link

kevinlui1109 commented Nov 29, 2016

Have to create a soft link or change it in my.cnf, otherwise MAMP cannot start or stop mysql properly.
ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock

@kamov

This comment has been minimized.

Copy link

kamov commented Dec 18, 2016

After running this script, I can't launch mamp anymore.

This is error message:

This is error log:
161218 9:39:38 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql/ is case insensitive
161218 9:39:38 [Note] Plugin 'FEDERATED' is disabled.
161218 9:39:39 InnoDB: The InnoDB memory heap is disabled
161218 9:39:39 InnoDB: Mutexes and rw_locks use GCC atomic builtins
161218 9:39:39 InnoDB: Compressed tables use zlib 1.2.3
161218 9:39:39 InnoDB: Initializing buffer pool, size = 128.0M
161218 9:39:39 InnoDB: Completed initialization of buffer pool
InnoDB: Error: checksum mismatch in data file ./ibdata1
161218 9:39:39 InnoDB: Could not open or create data files.
161218 9:39:39 InnoDB: If you tried to add new data files, and it failed here,
161218 9:39:39 InnoDB: you should now edit innodb_data_file_path in my.cnf back
161218 9:39:39 InnoDB: to what it was, and remove the new ibdata files InnoDB created
161218 9:39:39 InnoDB: in this failed attempt. InnoDB only wrote those files full of
161218 9:39:39 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
161218 9:39:39 InnoDB: remove old data files which contain your precious data!
161218 9:39:39 [ERROR] Plugin 'InnoDB' init function returned error.
161218 9:39:39 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
161218 9:39:39 [ERROR] Unknown/unsupported storage engine: InnoDB
161218 9:39:39 [ERROR] Aborting

161218 9:39:39 [Note] /Applications/MAMP/Library/bin/mysqld: Shutdown complete

161218 09:39:39 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
161218 09:43:17 mysqld_safe Starting mysqld daemon with databases from /Library/Application Support/appsolute/MAMP PRO/db/mysql
161218 9:43:17 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql/ is case insensitive
161218 9:43:17 [Note] Plugin 'FEDERATED' is disabled.
161218 9:43:17 InnoDB: The InnoDB memory heap is disabled
161218 9:43:17 InnoDB: Mutexes and rw_locks use GCC atomic builtins
161218 9:43:17 InnoDB: Compressed tables use zlib 1.2.3
161218 9:43:17 InnoDB: Initializing buffer pool, size = 128.0M
161218 9:43:17 InnoDB: Completed initialization of buffer pool
InnoDB: Error: checksum mismatch in data file ./ibdata1
161218 9:43:17 InnoDB: Could not open or create data files.
161218 9:43:17 InnoDB: If you tried to add new data files, and it failed here,
161218 9:43:17 InnoDB: you should now edit innodb_data_file_path in my.cnf back
161218 9:43:17 InnoDB: to what it was, and remove the new ibdata files InnoDB created
161218 9:43:17 InnoDB: in this failed attempt. InnoDB only wrote those files full of
161218 9:43:17 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
161218 9:43:17 InnoDB: remove old data files which contain your precious data!
161218 9:43:17 [ERROR] Plugin 'InnoDB' init function returned error.
161218 9:43:17 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
161218 9:43:17 [ERROR] Unknown/unsupported storage engine: InnoDB
161218 9:43:17 [ERROR] Aborting

161218 9:43:17 [Note] /Applications/MAMP/Library/bin/mysqld: Shutdown complete

161218 09:43:17 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended

any idea how to fix?
Thanks

@field2

This comment has been minimized.

Copy link

field2 commented Jan 25, 2017

+1 on getting this to run in windows, especially since mamp 4 isn't available for windows yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.