码迷,mamicode.com
首页 > 数据库 > 详细

MySQL57修改root密碼

时间:2018-08-02 22:59:06      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:管理   inpu   you   bin   com   nbsp   修改   welcome   gis   

之前在電腦里安裝了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>

MySQL57修改root密碼

标签:管理   inpu   you   bin   com   nbsp   修改   welcome   gis   

原文地址:https://www.cnblogs.com/keepee/p/9409738.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!