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;