Mac系统下源码编译安装MySQL 5.7.17的教程
程序员文章站
2023-11-25 13:44:22
1、下载并解压到:/users/xiechunping/softwares/mysql-5.7.17
下载地址:http://ftp.ntu.edu.tw/pub/mys...
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的教,希望对大家有所帮助