1、解壓文件,例如:置於E:\Program Files\mysql-5.7.24-winx64,新建my.ini ,內容如下:
[mysqld] # 設置為自己MYSQL的安裝目錄 basedir=E:\Program Files\mysql-5.7.24-winx64 # 設置為MYSQL的數據目錄 datadir=E:\Program Files\mysql-5.7.24-winx64\data port=3306 character_set_server=utf8 sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER #開啟查詢緩存 explicit_defaults_for_timestamp=true #skip-grant-tables
新建data文件夾;
2、環境變量中,配置path:;E:\Program Files\mysql-5.7.24-winx64\bin;
3、cmd管理員身份打開,定位到E:\Program Files\mysql-5.7.24-winx64\bin下,執行命令:
mysqld -install [服務名]
顯示服務創建成功。服務名默認為mysql;
4、獲取初始密碼,執行命令:
mysqld --initialize --user=mysql --console
記錄末尾的密碼,初次登陸時使用,例如:localhost: x;4aCuXaUHx-;
5、啟動服務,執行命令:
net start mysql
6、登陸mysql:
mysql -u root -p
輸入步驟4中的密碼,登陸成功;
7、設置默認密碼,依次輸入下列命令:
use mysql; alter user 'root'@'localhost' identified by 'mysql'; SET PASSWORD = PASSWORD('123456'); flush privileges;
8、連接MySql-Front提示異常信息The'INFORMATION_SCHEMA.SESSION_VARIABLES' feature is disabled; see thedocumentation for 'show_compatibility_56',執行如下代碼:
MySQL> select * from information_schema.global_status limit 3; ERROR 3167 (HY000): The 'INFORMATION_SCHEMA.GLOBAL_STATUS' feature is disabled; see the documentation for 'show_compatibility_56' --查看show_compatibility_56其值 MySQL> show variables like '%show_compatibility_56%'; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | show_compatibility_56 | OFF | +-----------------------+-------+ 1 row in set (0.01 sec) --把show_compatibility_56打開 mysql> set global show_compatibility_56=on; Query OK, 0 rows affected (0.00 sec) mysql> show variables like '%show_compatibility_56%'; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | show_compatibility_56 | ON | +-----------------------+-------+ 1 row in set (0.00 sec) mysql> select * from information_schema.global_status limit 3; +-----------------------+----------------+ | VARIABLE_NAME | VARIABLE_VALUE | +-----------------------+----------------+ | ABORTED_CLIENTS | 0 | | ABORTED_CONNECTS | 0 | | BINLOG_CACHE_DISK_USE | 0 | +-----------------------+----------------+ 3 rows in set, 1 warning (0.00 sec)