-
-
Save dj1020/2abeced8aac98bdd1690 to your computer and use it in GitHub Desktop.
#!/bin/sh | |
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.9-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 |
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
This worked well, BUT with a few alterations.
- It didn't work when running as a script - I had to run each step manually.
- I had to append --force to mysql_upgrade
Thanks for this.
Hi
I tried the above running each step manually on mac. I also appended --force to mysql_upgrade. However, I received the following warning message on my phpmyadmin
Warning in ./libraries/dbi/DBIMysqli.class.php#258
mysqli_query(): (HY000/1682): Native table 'performance_schema'.'session_variables' has the wrong structure
Backtrace
./libraries/dbi/DBIMysqli.class.php#258: mysqli_query(
object,
string 'SHOW VARIABLES LIKE \'character_set_results\'',
integer 0,
)
./libraries/DatabaseInterface.class.php#183: PMA_DBI_Mysqli->realQuery(
string 'SHOW VARIABLES LIKE \'character_set_results\'',
object,
integer 0,
)
./libraries/DatabaseInterface.class.php#84: PMA_DatabaseInterface->tryQuery(
string 'SHOW VARIABLES LIKE \'character_set_results\'',
object,
integer 0,
boolean true,
)
./libraries/DatabaseInterface.class.php#1687: PMA_DatabaseInterface->query(
string 'SHOW VARIABLES LIKE \'character_set_results\'',
object,
)
./libraries/DatabaseInterface.class.php#2435: PMA_DatabaseInterface->postConnect(object)
./libraries/common.inc.php#984: PMA_DatabaseInterface->connect(
string ********,
string ********,
boolean false,
)
./index.php#12: require_once(./libraries/common.inc.php)
And on my command line, I received the following
$ /Applications/MAMP/Library/bin/mysql_upgrade --user=root --password=root --host=localhost --port=3306 --force
mysql_upgrade: [Warning] Using a password on the command line interface can be insecure.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv OK
mysql.db OK
mysql.engine_cost OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.gtid_executed OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv
error : Table upgrade required. Please do "REPAIR TABLE `proxies_priv`" or dump/reload to fix it!
mysql.server_cost OK
mysql.servers OK
mysql.slave_master_info OK
mysql.slave_relay_log_info OK
mysql.slave_worker_info OK
mysql.slow_log OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Repairing tables
mysql.proxies_priv
Note : TIME/TIMESTAMP/DATETIME columns of old format have been upgraded to the new format.
status : OK
Upgrading the sys schema.
Checking databases.
sys.sys_config OK
Repairing tables
mysql.proxies_priv OK
Upgrade process completed successfully.
Checking if update is needed.
Note: It might help anyone else
You might need to run the commands separately and refer to your correct path and mysql version. I did the following after manually downloading and installing mysql 5.7 (It appears under System preferences)
I ran the following commands.
cd to the location of your new mysql installation . i.e
cd /usr/local/
sudo rsync -av mysql/bin/* /Applications/MAMP/Library/bin/ --exclude=mysqld_multi --exclude=mysqld_safe
sudo chmod -R o+rw /Applications/MAMP/db/mysql56/
sudo chmod -R o+rw /Applications/MAMP/tmp/mysql56/
sudo chmod -R o+rw /Applications/MAMP/tmp/mysql/
ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
sudo chmod -R 777 /Applications/MAMP/db/mysql56
sudo chmod -R 777 /Applications/MAMP/db/mysql56/
/Applications/MAMP/Library/bin/mysql_upgrade --user=root --password=root --host=localhost --port=3306
thanks! that worked perfectly