zl程序教程

您现在的位置是:首页 >  .Net

当前栏目

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

2023-02-18 15:41:09 时间

在测试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';