Linux下MySQL配置远程连接失败 原创 数据库 2021年9月1日 10:32 夏至未至 1487 当前内容 1140 字,在路上,马上到,马上到 #### 权限问题 1130 - Host 'xxx.xxx.xx.xxx' is not allowed to connect to this MySQL server 处理语法如下: GRANT ALL PRIVILEGES ON *.* TO '用户'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION; grant 权限 on 库内对象 to 用户 ip 这里表示赋予该用户所有数据库所有表(*.*表示所有表),%表示所有IP地址。 实际操作如下: mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> #### 防火墙问题 报错如下: ERROR 2003 (HY000): Can't connect to MySQL server on '你要连接的IP' (111) 关闭防火墙即可,或开放端口 查看防火墙状态:service iptables status或者systemctl status firewalld或者firewall-cmd --state 暂时关闭防火墙:systemctl stop firewalld或者service iptables stop或者systemctl stop firewalld.service 永久关闭防火墙:systemctl disable firewalld或者chkconfig iptables off或者systemctl disable firewalld.service 重启防火墙:systemctl enable firewalld或者service iptables restart 或者systemctl restart firewalld.service 永久关闭后重启:chkconfig iptables on #### 可能数据库配置了 bind-address 查看Mysql配置文件是否指定了**bind-address**,这表示只能是某个ip能连接,如果需要修改配置,需要要重启服务 本文标题: Linux下MySQL配置远程连接失败 本文作者: 夏至未至 发布时间: 2021年9月1日 10:32 最近更新: 2021年9月6日 03:35 原文链接: 许可协议: 署名-非商业性-禁止演绎 4.0 国际(CC BY-NC-ND 4.0) 请按协议转载并保留原文链接及作者 MySQL(28) Linux(24) 远程连接(1) 上一个 C/C++学习书籍资料整理 下一个 MySQL开启binlog,并以行模式记录 当前文章评论暂未开放,请移步至留言处留言。