MySQL 修改登录密码

导读:本篇文章讲解 MySQL 修改登录密码,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com

参考:MySQL的安装与配置——详细教程
这里直接上图:
在这里插入图片描述

具体操作和分析如下:

(c) Microsoft Corporation。保留所有权利。

C:\WINDOWS\system32>d: //跳到D盘

D:\>cd D:\mysql\mysql-8.0.26-winx64\mysql-8.0.26-winx64\bin   //跳到D盘中的mysql下的bin目录

D:\mysql\mysql-8.0.26-winx64\mysql-8.0.26-winx64\bin>mysqld --initialize --console //初始化mysql(会产生随机密码,在本句运行结果的结尾)
2022-07-13T00:53:38.987785Z 0 [System] [MY-013169] [Server] D:\mysql\mysql-8.0.26-winx64\mysql-8.0.26-winx64\bin\mysqld.exe (mysqld 8.0.26) initializing of server in progress as process 8588
2022-07-13T00:53:38.988771Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2022-07-13T00:53:39.045319Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-07-13T00:53:46.582556Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-07-13T00:54:04.736489Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2022-07-13T00:54:04.737282Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2022-07-13T00:54:04.817255Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: v&o.!JeW_2<f  //随机密码

D:\mysql\mysql-8.0.26-winx64\mysql-8.0.26-winx64\bin>net start MySQL //开启mysql服务
MySQL 服务正在启动 ..
MySQL 服务已经启动成功。


D:\mysql\mysql-8.0.26-winx64\mysql-8.0.26-winx64\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.26

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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> alter user 'root'@'localhost' identified by '123456';  //修改密码
Query OK, 0 rows affected (0.16 sec)  //修改密码成功

mysql> \q //退出
Bye

D:\mysql\mysql-8.0.26-winx64\mysql-8.0.26-winx64\bin>mysql -u root -p //登录 验证新密码
Enter password: ******  //登录新密码
Welcome to the MySQL monitor.  Commands end with ; or \g.  //登录成功
Your MySQL connection id is 9
Server version: 8.0.26 MySQL Community Server - GPL

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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> \q  //推出
Bye

D:\mysql\mysql-8.0.26-winx64\mysql-8.0.26-winx64\bin>

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/118118.html

(0)
seven_的头像seven_bm

相关推荐

发表回复

登录后才能评论
极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!