MySQL学习(第一篇: 在windows搭建MySQL服务)

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,破解其它版本可能无效。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值