简体   繁体   English

Ubuntu Mysql Server不允许远程连接

[英]Ubuntu Mysql Server not allowing remote connections

I've looked in so many areas to try to fix this problem and I can't seem to find a solution. 我已经研究了很多领域来尝试解决此问题,但似乎找不到解决方案。 Im running ubuntu linux with the latest mysql and phpmyadmin installation. 我正在使用最新的mysql和phpmyadmin安装程序运行ubuntu linux。 I found that connecting to the database locally works but if I try to connect remotely it keeps denying the connections. 我发现在本地连接数据库是可行的,但是如果我尝试远程连接,它将一直拒绝连接。 The only way I can login to phpmyadmin is if I put the ip address in the bar, connecting via the web address will not work. 我可以登录phpmyadmin的唯一方法是,如果将IP地址放在栏中,则无法通过网址进行连接。

Are you trying to connect to MySQL remotely or PHPMyAdmin remotely? 您是要远程连接到MySQL还是要远程连接PHPMyAdmin?

If you are trying to access MySQL remotely, you need to do the following: 如果您尝试远程访问MySQL,则需要执行以下操作:

  • Edit the bind-address variable in /etc/my.cnf , to 0.0.0.0 or the IP address of your server /etc/my.cnf中bind-address变量编辑为0.0.0.0或服务器的IP地址
  • Make sure your MySQL user has permissions from remote hosts, do this using: 确保您的MySQL用户具有远程主机的权限,请执行以下操作:

    CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass'; 创建用户'myuser'@'localhost'由'mypass'标识;

    CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass'; 创建用户'myuser'@'%'由'mypass'标识;

  • Then: 然后:

    GRANT ALL ON . 授予所有 TO 'myuser'@'localhost'; 到'myuser'@'localhost';

    GRANT ALL ON . 授予所有 TO 'myuser'@'%'; 到'myuser'@'%';

Then go ahead and restart the mysql instance on your server. 然后继续并重新启动服务器上的mysql实例。 This also assumes you have set IP tables up to allow port 3306 TCP incoming to your server. 这还假定您已设置IP表以允许端口3306 TCP传入服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM