博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux mysqlERROR 1045 (28000): linux忘记数据库密码
阅读量:4577 次
发布时间:2019-06-08

本文共 603 字,大约阅读时间需要 2 分钟。

已验证没问题

 

#1.停止mysql数据库(确定能停止掉,不然第二部有问题

/etc/init
.d
/mysqld 
stop
 
#2.执行如下命令
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
 
#3.使用root登录mysql数据库
mysql -u root mysql
 
#4.更新root密码
mysql> UPDATE user SET Password=PASSWORD(
'newpassword'
) where USER=
'root'
;
#最新版MySQL请采用如下SQL:
mysql> UPDATE user SET authentication_string=PASSWORD(
'newpassword'
) where USER=
'root'
;
 
#5.刷新权限 
mysql> FLUSH PRIVILEGES;
 
#6.退出mysql
mysql> quit
 
#7.重启mysql
/etc/init
.d
/mysqld 
restart
 
#8.使用root用户重新登录mysql
mysql -uroot -p 
Enter password: <输入新设的密码newpassword>

转载于:https://www.cnblogs.com/weiyiyong/p/7636333.html

你可能感兴趣的文章
《java JDK7 学习笔记》之接口与多态
查看>>
LeetCode 96:Unique Binary Search Trees
查看>>
kernel-char设备的建立
查看>>
DVWA-CSRF
查看>>
ubuntu common software introduction
查看>>
资源相互引用时 需添加 PerformSubstitution=True
查看>>
MapRedece(单表关联)
查看>>
蒲公英App开发之检测新版本
查看>>
【安卓基础】倒计时按钮封装(验证码倒计时按钮)
查看>>
configparser模块
查看>>
SelectQueryBuilder的用法
查看>>
android的用户定位(一)
查看>>
creat-react-app搭建的项目中按需引入antd以及配置Less和如何修改antd的主题色
查看>>
IIS安装
查看>>
html块级元素和行级元素的区别和使用
查看>>
for循环嵌套
查看>>
寒冬夜行人
查看>>
poj1151 Atlantis
查看>>
HTML页面之间的参数传递
查看>>
java面试题集锦
查看>>