1、下载
版本路径:https://dev.mysql.com/downloads/file/?id=485812
2、安装mysql-8.0.16-winx64
安装完毕后,把mysql-8.0.16-winx64\bin目录设置到系统目录。
3、初始化 mysql
执行命令:mysqld --initialize --user=mysql --console
具体为:
D:\tools\DB\mysql-8.0.16-winx64\bin>mysqld --initialize --user=mysql --console
2019-05-29T02:53:44.964834Z 0 [System] [MY-013169] [Server] D:\tools\DB\mysql-8.
0.16-winx64\bin\mysqld.exe (mysqld 8.0.16) initializing of server in progress as
process 3972
2019-05-29T02:54:12.521410Z 5 [Note] [MY-010454] [Server] A temporary password i
s generated for root@localhost: ;o!#/UMer3:B
2019-05-29T02:54:23.912061Z 0 [System] [MY-013170] [Server] D:\tools\DB\mysql-8.
0.16-winx64\bin\mysqld.exe (mysqld 8.0.16) initializing of server has completed
D:\tools\DB\mysql-8.0.16-winx64\bin>
4、启动mysql服务
执行命令:net start MySQL
具体为:
C:\Users\hm>net start mysql
请求的服务已经启动。
5、登录mysql
执行命令:mysql -uroot -p
D:\tools\DB\mysql-8.0.16-winx64\bin>mysql -uroot -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.16 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
6、查看mysql服务端口号
执行命令:show global variables like ‘port’;
mysql> show global variables like 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port | 3306 |
+---------------+-------+
1 row in set, 1 warning (0.01 sec)
7、navicat连接本地mysql服务
出现如下报错,
解决办法:
1)删除navicat中的mysql数据库连接。
2)在命令行登录mysql,然后执行下面几步:
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘password’ PASSWORD EXPIRE NEVER;
ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘123456’;
FLUSH PRIVILEGES;
然后再用navicat连接mysql,就可以登录成功了。见下图:
注: navicat工具试用期只有两周,建议使用navicat12018_premium_cs_x64.exe,并用Navicat+Premium+12+破解补丁.rar,破解其它版本可能无效。