解决mysql localhost可以连接但是127.0.0.1不能连接

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

猜你喜欢

转载自www.cnblogs.com/LucasSong/p/12926600.html