Ubuntu重置Mysql密码

时间:2020-07-21 09:48:47   收藏:0   阅读:87

Ubuntu重置Mysql密码

太久没有用Linux的Mysql,忘记密码。这里记录一下在Ubuntu下重置Mysql密码。

1.使用命令:cat /etc/mysql/debian.cnf

技术图片

2.使用user和password登陆mysql,然后切换到mysql数据库。缺省有两个数据库:mysql和test。 mysql库存放着mysql的系统和用户权限信息,我们改密码和新增用户,实际上就是对这个库进行操作。

技术图片

3.使用命令更新root密码

update mysql.user set authentication_string=password(‘123456‘) where user=‘root‘ and Host=‘localhost‘;

update user set plugin=‘mysql_native_password‘;

flush privileges;

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!