mysql安装流程记录

这篇博客详细记录了MySQL的安装过程,包括下载地址、解压、管理员权限CMD命令执行初始化、安装、启动服务,以及遇到登录报错后如何正确重置密码的步骤。重置密码的关键在于正确执行相关命令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.下载地址
mysql解压版下载地址

2.解压后的文件更名为mysql,放置在指定纯英文路径文件夹,本文放置在d:/develop文件夹下

3.以管理员身份运行CMD,执行代码如下:

3.1初始化

D:\develop\mysql\bin>mysqld --initialize --user=mysql --console

得到结果

2019-04-01T05:30:44.243021Z 0 [System] [MY-013169] [Server] D:\develop\mysql\bin\mysqld.exe (mysqld 8.0.15) initializing of server in progress as process 7256
2019-04-01T05:31:07.351423Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 1Rl4ffRnt,R=
2019-04-01T05:31:15.690623Z 0 [System] [MY-013170] [Server] D:\develop\mysql\bin\mysqld.exe (mysqld 8.0.15) initializing of server has completed

保存临时密码:1Rl4ffRnt,R=
3.2安装

D:\develop\mysql\bin>mysqld --install MySQL

得到结果

Service successfully installed.

3.3启动服务

D:\develop\mysql\bin>net start MySQL

得到结果

MySQL 服务正在启动 ..
MySQL 服务已经启动成功。

3.4登录

D:\develop\mysql\bin>mysql -u root -p
Enter password: ************

得到结果

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.15
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

此处多为官话,要记住的点是mysql命令末尾加;
3.5在尝试调出databases的时候出现了报错

mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

重置密码的正确形式

mysql> alter user user() identified by "123456";
Query OK, 0 rows affected (0.15 sec)

3.6 之后退出服务重新登录检验之前的设置

mysql> exit;
Bye

D:\develop\mysql\bin>mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.15 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.02 sec)

mysql>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值