1、下载

版本路径:https://dev.mysql.com/downloads/file/?id=485812
MySQL学习(第一篇: 在windows搭建MySQL服务)

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 [email protected]: ;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服务

MySQL学习(第一篇: 在windows搭建MySQL服务)
出现如下报错,
MySQL学习(第一篇: 在windows搭建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,就可以登录成功了。见下图:
MySQL学习(第一篇: 在windows搭建MySQL服务)
: navicat工具试用期只有两周,建议使用navicat12018_premium_cs_x64.exe,并用Navicat+Premium+12+**补丁.rar,**其它版本可能无效。

相关文章:

  • 2022-12-23
  • 2021-05-28
  • 2021-05-24
  • 2021-07-28
  • 2021-08-12
  • 2021-07-23
  • 2022-12-23
猜你喜欢
  • 2021-05-21
  • 2021-07-04
  • 2021-12-04
  • 2022-01-05
  • 2021-11-12
  • 2021-08-12
相关资源
相似解决方案