Mac系统下源码编译安装MySQL 5.7.17
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,执行cmakecd ../mysql-5.7.17cmake -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/mysqlbin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/db_datasupport-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 stopbin/mysql -u root mysqlmysql>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 -pEnter password: <输入新设的密码mysql54321>mysql>SET PASSWORD = PASSWORD('mysql54321');mysql>ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;mysql>flush privileges;mysql>quit;