sankye

use mysql;

update user set host = \'%\' where user = \'root\';

select host, user from user; flush privileges;

出错不管他 

 

mysql> select host ,user from user;
+-----------+------------------+
| host | user |
+-----------+------------------+
| % | admin |
| % | root |
| 127.0.0.1 | root |
| ::1 | root |
| localhost | debian-sys-maint |
| ubuntu | root |
+-----------+------------------+

关键是这一行:| % | root | %

表示可以允许任何机器访问。

此时远程还是连不上。

然后查看3306端口情况

使用nestat命令查看3306端口状态:

~# netstat -an | grep 3306

tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN

从结果可以看出3306端口只是在IP 127.0.0.1上监听,所以拒绝了其他IP的访问。

解决方法:修改/etc/mysql/my.cnf文件。打开文件,找到下面内容:

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address  = 127.0.0.1

分类:

技术点:

相关文章:

  • 2021-06-13
  • 2021-06-19
  • 2021-06-25
  • 2022-01-08
  • 2021-12-26
  • 2021-12-29
猜你喜欢
  • 2021-03-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-25
  • 2021-07-14
相关资源
相似解决方案