当前位置:Gxlcms > 数据库问题 > ubuntu 部署的mysql无法远程链接

ubuntu 部署的mysql无法远程链接

时间:2021-07-01 10:21:17 帮助过:18人阅读

允许远程用户登录访问mysql的方法

  从任何主机上使用root用户,密码:youpassword(你的root密码)连接到mysql服务器:

# mysql -u root -proot 
mysql>GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘youpassword‘ WITH GRANT OPTION;

操作完后切记执行以下命令刷新权限 

FLUSH PRIVILEGES 

 

如果还是无法链接,如:

报错信息:pymysql.err.OperationalError: (2003, "Can‘t connect to MySQL server on ‘192.168.0.102‘ ([WinError 10061] 由于目标计算机积极拒绝,无法连接。)")

解决方法:vim /etc/mysql/mysql.conf.d/mysqld.cnf

技术分享

 

如果怀疑是iptables的问题,

请用如下命令

iptables -P INPUT ACCEPT  

iptables -P OUTPUT ACCEPT  

暂时开放所有端口

Ubuntu上没有关闭iptables的命令

这个方法只适合临时测试用

 

ubuntu 部署的mysql无法远程链接

标签:pos   password   使用   win   logs   output   img   ide   connect   

人气教程排行