Is it possible to upgrade the MySQL in MAMP to MySQL 5.7?

后端 未结 3 1463
Happy的楠姐
Happy的楠姐 2021-01-05 06:20

Is it possible to upgrade the MAMP MySQL library to 5.7? I am currently running 5.6 (which I upgraded to using MAMP’s upgrade script ) Or would I need to install MySQL nativ

3条回答
  •  心在旅途
    2021-01-05 06:28

    I encountered problems upgrading to MySQL 5.7.22 described in Giacomo1968’s answer.

    The updated procedure worked well on El Capitan with MySQL 5.7.18.

    I have written an updated bash script for this procedure:

    #!/bin/sh
    
    curl -OL https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18-macos10.12-x86_64.tar.gz
    tar xfvz mysql-5.7*
    
    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 -rf /Applications/MAMP/db/mysql57/mysql/innodb_*
    
    sudo rm -rf /Applications/MAMP/db/mysql57/mysql/slave_*
    
    sudo chown -R ${USER}:admin /Applications/MAMP/db/mysql57
    
    sed -i.bak 's/mysql56/mysql57/g' /Applications/MAMP/Library/bin/mysqld_safe
    
    echo "Finally, if you use MAMP and set a my.cnf file, that should be set in /Applications/MAMP/conf/my.cnf… But by doing this upgrade, the default search path of the my.cnf in MAMP will be /usr/local/mysql/etc/ instead of the expected /Applications/MAMP/conf/ since that is where the new binary expects it to be set. Clearly we’re not going to recompile MySQL at this point so the cleanest/simplest thing to do to make your MAMP setup truly portable again is to change this line in the startMysql.sh from this:
    /Applications/MAMP/Library/bin/mysqld_safe --port=8889 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log &
    To this; note we are adding the --defaults-extra-file= option before all the otgers:
    /Applications/MAMP/Library/bin/mysqld_safe --defaults-extra-file=/Applications/MAMP/conf/my.cnf --port=8889 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log &"
    
    read -p "With all of that command line work done, launch MAMP via the application, start the MySQL and Apache servers."
    
    read -p "Press [Enter] key to start migration..."
    
    echo "Starting MySQL"
    
    /Applications/MAMP/Library/bin/mysql_upgrade --user=root --password=root --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --force
    
    echo "Migrate, finaly, to new version"
    
    /Applications/MAMP/Library/bin/mysql_config_editor --verbose set --socket=/Applications/MAMP/tmp/mysql/mysql.sock
    

提交回复
热议问题