欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 财经 > 产业 > Windows MySQL8密码忘了解决办法

Windows MySQL8密码忘了解决办法

2025/8/21 12:01:18 来源:https://blog.csdn.net/TOOZOOY/article/details/148631478  浏览:    关键词:Windows MySQL8密码忘了解决办法

1、在windows services 中停止mysql8 服务。

2、进入mysql8 安装目录,D:\Program Files\mysql-8.0.16-winx64\bin

以免密方式启动数据库:

mysqld --console --skip-grant-tables --shared-memory

3、以免费方式登录数据库:

D:\Program Files\mysql-8.0.16-winx64\bin>mysql -udev001 -P13306

注意此行命令不能加 -p,

-P为数据库端口

4、

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> SELECT ssl_type From mysql.user Where user="dev001";
+----------+
| ssl_type |
+----------+
| X509     |
+----------+
1 row in set (0.01 sec)mysql> update user set ssl_type='' where user='dev001';
ERROR 1046 (3D000): No database selected
mysql> use mysql;
Database changed
mysql> update user set ssl_type='' where user='dev001';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.03 sec)mysql> ALTER USER 'dev001'@'%' IDENTIFIED BY '密码';
Query OK, 0 rows affected (0.01 sec)mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)mysql> exit
Bye

5、关闭免费登录窗口

6、启动windows service 中的mysql服务

7、使用新密码登录数据库。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词