1、下載並解壓到:/Users/xiechunping/Softwares/mysql-5.7.17
下載地址:http://ftp.ntu.edu.tw/pub/MySQL/Downloads/MySQL-5.7/mysql-boost-5.7.17.tar.gz
2、進入mysql-5.7.17,執行cmake
cd ../mysql-5.7.17 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_USER=_mysql -DMYSQL_TCP_PORT=3306 -DMYSQL_DATADIR=/usr/local/mysql/db_data -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/Users/xiechunping/Softwares/mysql-5.7.17/boost
3、配置數據目錄權限
chown -R _mysql:_mysql /usr/local/mysql/db_data
4、編譯並安裝
make&&make install
5、安裝數據庫並啟動
cd /usr/local/mysql bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/db_data support-files/mysql.server start
6、修改數據庫root用戶密碼(首次進入密碼為空)
修改:/usr/local/mysql/support-files/mysql.server第280行
為mysql的啟動選項增加:--user=mysql --skip-grant-tables --skip-networking
執行:
support-files/mysql.server stop && support-files/mysql.server stop bin/mysql -u root mysql mysql>UPDATE user SET authentication_string=PASSWORD('mysql54321') where USER='root'; mysql>FLUSH PRIVILEGES; mysql>quit;
support-files/mysql.server stop
還原/usr/local/mysql/support-files/mysql.server文件
support-files/mysql.server start
bin/mysql -uroot -p Enter password: <輸入新設的密碼mysql54321> mysql>SET PASSWORD = PASSWORD('mysql54321'); mysql>ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; mysql>flush privileges; mysql>quit;
以上所述是小編給大家介紹的Mac系統下源碼編譯安裝MySQL 5.7.17的教,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對網站的支持!