Typecho合集站.  留言 关于 记事本 
首页 > TYPECHO > typecho教程 > typecho插件 > typecho主题 > 网站开发 > PHP > Linux > web > 编程 > 个人收藏 > 互联网旧文 > 互联网趣文

mysql8重置密码解决

1.检查版本

mysql -V
mysql  Ver 8.0.15 for Win64 on x86_64 (MySQL Community Server - GPL)

2.启动mysql8


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.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>

3.进入数据库的MySQL

use mysql
Database changed

4修改mysql8密码


ALTER user 'root'@'localhost' IDENTIFIED BY 'root'
Query OK, 0 rows affected (0.03 sec)

4.1mysql5的修改方法


update user set password=password("root") where user="root"
Query OK, 1 rows affected (0.04 sec)Rows matched: 1 Changed: 1 Warnings: 0

5.刷新数据库


 flush privileges;
 Query OK, 0 rows affected (0.01 sec)

6.退出mysql8

quit
Bye

7.mysql登录检验


C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
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>

注意:并没有修改C: ProgramData MySQL MySQL Server 8.0下的my.ini文件,即:加入skip-grant-tables

然后保存my.ini文件,接着win + x R打开service.msc重启mysql8,最后再按照1-7步骤操作


发表新评论


本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除
Theme by
夏目贵志, Powered by Typecho | RSS | sitemap