当前位置:Gxlcms > 数据库问题 > mysql修改root密码

mysql修改root密码

时间:2021-07-01 10:21:17 帮助过:24人阅读

mysql8.0.16

登录时出现ERROR 1130 (HY000): Host ‘localhost‘ is not allowed to connect to this MySQL server
出现此错误时,是root用户权限问题,客户端无法访问服务器
判断本次出现问题原因为:安装mysql后修改密码,修改密码使用了明文密码导致问题出现
update mysql.user set authentication_string=‘password‘ where user=‘root‘;
使用此方法修改密码就会出现此问题,正确修改密码方式如下
1、客户端无法登录mysql服务器,需要越权登录
mysqld --console --skip-grant-tables --shared-memory
2、越权可以直接通过mysql命令直接登录,然后进入user表将root用户密码修改为空,可使用update命令
3、退出mysql关闭1中打开的console,重启mysql,重新修改密码
alter user ‘root‘@‘localhost‘ identified by ‘password‘//此方法修改后的密码为加密的
网上有些修改密码方式为:
update mysql.user set authentication_string=password(‘password‘) where user=‘root‘;
尝试后无效,报错,猜测是password方法已经不被使用了

mysql修改root密码

标签:无法访问   his   使用   修改   安装mysql   mysql服务器   客户端   auth   通过   

人气教程排行