网上的N多方法都不全面,只有下面的第一步或第二步是不行的,必须同时执行下面两步操作

  1. 修改mysql.user表
    rootdebian-sys-maint身份登录mysql
$ mysql -u debian-sys-maint -p
mysql> use mysql
mysql> select Host, User from user;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'lxw'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
  1. 修改mysql配置文件
$ pwd
/etc/mysql/mysql.conf.d
$ vim mysqld.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
bind-address            = 0.0.0.0

修改完成后,需要重新启动mysql服务

$ /etc/init.d/mysql restart

References:

外部主机不允许连接Mysql设置的解决
mysql下怎样创建新用户,并允许其在任意主机登录啊

相关文章:

  • 2021-09-29
  • 2022-12-23
  • 2021-08-19
  • 2022-12-23
  • 2021-12-29
  • 2021-06-28
  • 2022-12-23
猜你喜欢
  • 2021-08-29
  • 2021-09-05
  • 2021-11-21
  • 2021-07-09
  • 2021-11-08
  • 2022-12-23
相关资源
相似解决方案