在Mac Mini / Time Capsule上远程访问MySQL

时间:2021-02-25 02:44:23

I'm currently trying to run an application on a server but my customer is very 'picky' about their data and wish to store the database on their own internal office server. I've installed MySQL and can get the application to run locally but for a few specific reasons the application needs to run else where.

我目前正在尝试在服务器上运行应用程序,但我的客户对他们的数据非常“挑剔”,并希望将数据库存储在他们自己的内部办公室服务器上。我已经安装了MySQL并且可以让应用程序在本地运行,但由于某些特定原因,应用程序需要在其他地方运行。

I basically can't get access to MySQL from a different location. I think my main stumbling block is port forwarding to the correct location. MySQL is installed on a mac mini with local IP address 192.168.1.242 and the router/modem is an Apple Time Capsule. I've tried looking at tutorials but they all have options that I don't have access to. I've attached a screenshot of the options I have access to and the settings I've tried so far.

我基本上无法从不同的位置访问MySQL。我认为我的主要障碍是将端口转发到正确的位置。 MySQL安装在具有本地IP地址192.168.1.242的mac mini上,路由器/调制解调器是Apple Time Capsule。我试过看教程,但他们都有我无法访问的选项。我附上了我可以访问的选项的屏幕截图以及我到目前为止尝试过的设置。

在Mac Mini / Time Capsule上远程访问MySQL 在Mac Mini / Time Capsule上远程访问MySQL

Other information possibly needed is:

其他可能需要的信息是:

  • I need to connect from PHP
  • 我需要从PHP连接
  • I've set a user up within MySQL with a wildcard (%)
  • 我使用通配符(%)在MySQL中设置了一个用户
  • I'm testing it using the following: command on my local machine in CMD: mysql -u username -h remote_ip_address -p
  • 我在CMD中使用以下命令在我的本地机器上测试它:mysql -u username -h remote_ip_address -p
  • I get the following error: ERROR 2003 (HY000): Can't connect to MySQL server on 'REMOTE_IP_ADDRESS' (10061)
  • 我收到以下错误:ERROR 2003(HY000):无法连接到'REMOTE_IP_ADDRESS'上的MySQL服务器(10061)
  • Firewall is turned off completely on the Mac Mini
  • Mac Mini上的防火墙完全关闭
  • There is nothing in the my.cnf file
  • my.cnf文件中没有任何内容
  • OS is Sierra
  • 操作系统是Sierra

That's all I can think of at the moment but any advice would be greatly appreciated and any more information required can be provided.

这就是我现在所能想到的,但任何建议都会受到高度赞赏,并且可以提供所需的更多信息。

PS. evidently I'm not very good with MAC machines/networks

PS。显然我对MAC机器/网络不是很了解

2 个解决方案

#1


1  

For anyone that reads this I had a very specific issue. I installed MySQL using homebrew. Homebrew binds MySQL to 127.0.0.1 therefore will only allow connections to MySQL from the same machine no matter what you try to do. To fix it I've had to edit /usr/local/Cellar/mysql//homebrew.mxcl.mysql.plist and replace --bind-address=127.0.0.1 with bind-address=*.

对于任何阅读此内容的人我都有一个非常具体的问题。我用自制软件安装了MySQL。 Homebrew将MySQL绑定到127.0.0.1,因此无论您尝试做什么,它都只允许从同一台机器连接到MySQL。要修复它,我必须编辑/usr/local/Cellar/mysql//homebrew.mxcl.mysql.plist并用bind-address = *替换--bind-address = 127.0.0.1。

#2


0  

MySQL has an internal firewall of users/IPs. Even if you can connect locally, you might not have permission remotely:

MySQL有一个用户/ IP的内部防火墙。即使您可以在本地连接,也可能没有远程权限:

Try this as root user on the MySQL server (locally first!)

在MySQL服务器上以root用户身份尝试此操作(本地优先!)

 GRANT ALL ON <db>.* TO '<user>'@'<remoteIP>' IDENTIFIED BY '<password>';

Where

哪里

<db> is the name of the DB

是数据库的名称

<user> is name under which you connect

是您连接的名称

<remoteIP> is your external office IP FROM which you are trying to connect

是您尝试连接的外部办公室IP FROM

<password> should be self-explanatory!

应该是不言自明的!

This will explain the options better

这将更好地解释选项

#1


1  

For anyone that reads this I had a very specific issue. I installed MySQL using homebrew. Homebrew binds MySQL to 127.0.0.1 therefore will only allow connections to MySQL from the same machine no matter what you try to do. To fix it I've had to edit /usr/local/Cellar/mysql//homebrew.mxcl.mysql.plist and replace --bind-address=127.0.0.1 with bind-address=*.

对于任何阅读此内容的人我都有一个非常具体的问题。我用自制软件安装了MySQL。 Homebrew将MySQL绑定到127.0.0.1,因此无论您尝试做什么,它都只允许从同一台机器连接到MySQL。要修复它,我必须编辑/usr/local/Cellar/mysql//homebrew.mxcl.mysql.plist并用bind-address = *替换--bind-address = 127.0.0.1。

#2


0  

MySQL has an internal firewall of users/IPs. Even if you can connect locally, you might not have permission remotely:

MySQL有一个用户/ IP的内部防火墙。即使您可以在本地连接,也可能没有远程权限:

Try this as root user on the MySQL server (locally first!)

在MySQL服务器上以root用户身份尝试此操作(本地优先!)

 GRANT ALL ON <db>.* TO '<user>'@'<remoteIP>' IDENTIFIED BY '<password>';

Where

哪里

<db> is the name of the DB

是数据库的名称

<user> is name under which you connect

是您连接的名称

<remoteIP> is your external office IP FROM which you are trying to connect

是您尝试连接的外部办公室IP FROM

<password> should be self-explanatory!

应该是不言自明的!

This will explain the options better

这将更好地解释选项