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

mysql忘记密码解决办法

时间:2018-10-11 23:43:37      阅读:261      评论:0      收藏:0      [点我收藏+]

标签:ant   ati   解决   window   serve   改密码   moni   state   直接   

  今天,在新装的mysql上限制只能通过127.0.0.1登录之后怎么也登录不上。

1.在my.cnf最后一行(或者mysqld下面)设置跳过密码验证的过程(windows是my.ini)

skip-grant-tables

 

 

2.重启mysql服务

service mysqld restart

 

 

3.直接输入mysql即可

[root@VM_0_12_centos ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1313
Server version: 5.6.41 MySQL Community Server (GPL)

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

 

 

4.修改密码:

update user set Password=PASSWORD("newword") where user=root;

 

 

5.使修改生效

flush privileges;

 

 

6.修改完之后记得去掉跳过密码验证的设置,修改/etc/my.cnf去掉设置

 

7.正常使用即可

 

mysql忘记密码解决办法

标签:ant   ati   解决   window   serve   改密码   moni   state   直接   

原文地址:https://www.cnblogs.com/qlqwjy/p/9775458.html

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