MySQL57修改root密碼

之前在電腦里安裝了MySQL57之后,一直沒用,卻忘記了root密碼,

 

在網上找了一些資料修改root密碼,卻一直出錯。直到試到這個:

 

用管理員權限打開CMD

CD C:\Program Files\MySQL\MySQL Server 5.7\bin

net stop mysql57

mysqld --skip-grant-tables

 

再另外打開一個管理員權限的CMD

CD C:\Program Files\MySQL\MySQL Server 5.7\bin

mysql

mysql> use mysql

mysql> update mysql.user set authentication_string=PASSWORD('yourpassword') where user='root';

mysql> flush privileges;

mysql> quit
Bye

OK,用新密碼登陸即可:

C:\Program Files\MySQL\MySQL Server 5.7\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: 5.7.15 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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>

posted @   Bruce_Cheung  阅读(150)  评论(2编辑  收藏  举报
编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
点击右上角即可分享
微信分享提示