当前位置:Gxlcms > 数据库问题 > [日常] 解决mysql localhost可以连接但是127.0.0.1不能连接

[日常] 解决mysql localhost可以连接但是127.0.0.1不能连接

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

在测试mysql的过程中遇到使用localhost可以连接但是127.0.0.1不能连接,原因是localhost使用的本地socket连接,127.0.0.1使用使用的tcp连接

在mysql库的user表中,root账号默认的加密验证方式是auth_socket是,从新使用新的方式生成一下密码加密就可以了

可以更改下用户的加密方式:
update user set authentication_string=password("123456"),plugin=‘mysql_native_password‘ where user=‘root‘;

[日常] 解决mysql localhost可以连接但是127.0.0.1不能连接

标签:加密   nat   验证方式   pass   生成   用户   验证   native   date   

人气教程排行