0 概述
本文使用的mysql 版本mysql-5.7.13-osx10.11-x86_64.tar.gz。
1 安装过程
解压后:
sudo cp -r mysql-5.7.13-osx10.11-x86_64 /usr/local/mysql
切换到mysql 目录
执行安装初始化工作
sudo bin/mysqld –initialize –user=mysql
2017-07-22T05:01:47.646022Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-07-22T05:01:47.654989Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2017-07-22T05:01:47.839522Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-07-22T05:01:47.863475Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-07-22T05:01:47.927757Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: dd8f7f4e-6e9a-11e7-980f-1a7500a020c2.
2017-07-22T05:01:47.943281Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-07-22T05:01:47.948597Z 1 [Note] A temporary password is generated for root@localhost: w,<GP%%dg8Sh
注意这里最后一行,会生成一个root用户的密码。
启动mysql:
sudo ./support-files/mysql.server start
切换到bin目录
执行命令:./mysql -u root -p
按照提示输入上面生成的密码即可进入mysql控制台
输入:ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘MyNewPass’;
更多可以参考:mysql 官方