1、下载
http://www.mysql.com//Downloads/MySQL-5.7/mysql-5.7.17-winx64.zip(需要私聊)
2.解压缩zip包;
E:\wnmp\server\mysql5.7.17
3.配置环境变量,
3.1 添加path路径,
E:\wnmp\server\mysql5.7.17 \bin
3.2.修改mysql-default.ini配置文件,
原
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
改为
# These are commonly set, remove the # and set as required.
basedir = e:/wnmp/server/mysql5.7.17
datadir = e:/wnmp/server/mysql5.7.17/Data
port = 3306
# server_id = .....
4.以管理员身份进入命令提示符 cmd
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>mysqld --initialize --user=mysql --console
2016-05-08T02:58:49.494014Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is
deprecated. Please use --explicit_defaults_for_timestamp server option (see doc
umentation for more details).
2016-05-08T02:58:49.530016Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'E
RROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will
be merged with strict mode in a future release.
2016-05-08T02:58:49.530016Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not s
et.
2016-05-08T02:58:52.348376Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-05-08T02:58:52.869005Z 0 [Warning] InnoDB: Creating foreign key constraint
system tables.
2016-05-08T02:58:53.432037Z 0 [Warning] No existing UUID has been found, so we a
ssume that this is the first time that this server has been started. Generating
a new UUID: cc42ac67-14c8-11e6-90e5-08606e8d1296.
2016-05-08T02:58:53.533043Z 0 [Warning] Gtid table is not ready to be used. Tabl
e 'mysql.gtid_executed' cannot be opened.
2016-05-08T02:58:53.791057Z 1 [Note] A temporary password is generated for root@
localhost: UiS<C(.i(0yg
C:\Windows\system32>E:
E:\>cd E:\wnmp\server\mysql5.7.17\bin
E:\wnmp\server\mysql5.7.17\bin>
E:\wnmp\server\mysql5.7.17\bin>mysqld --install MySQL57
Service successfully installed.
注:如果上面这一步没有正确执行,请把杀毒软件关闭再继续上面这行命令
E:\wnmp\server\mysql5.7.17\bin>net start MYSQL57
The MySQL service is starting.
The MySQL service was started successfully.
E:\wnmp\server\mysql5.7.17\bin>mysql -u root -p
Enter password:UiS<C(.i(0yg
set password for root@localhost = password('hxl520');
注意:第一次登录一般没有密码,如果不能登录按照下面的步骤操作。
在my.ini 增加配置
skip-grant-tables
重启服务,在重试登录。
执行 use mysql
update mysql.user set authentication_string=password(‘root’) where user=’root’ ;
再删除:
skip-grant-tables 配置。
重启mysql 服务。