mysql 远程可以连接 localhost或者127.0.0.1 不能连接问题解决

mysql 安装完成后 ,在别的客户端上可以连接到服务器,但是在服务器上使用localhost却不能访问。

选择mysql库,使用命令或者窗口都行;

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

查看user表数据,使用命令返回内容太多,用工具查看比较好。如下

如果host为127.0.0.1的密码和%的不一致,或者配置不一致,可以选择删除127.0.0.1的数据,或者修改其数据。

如下命令:

Delete FROM user Where User=’’ or Host=’localhost’ or or Host='127.0.0.1';

flush privileges;

猜你喜欢

转载自blog.csdn.net/gpweixing/article/details/111115624
今日推荐