我有两个类似的域
- xyz
- abc
在xyz中,我有管理文件夹,我的主数据库也上传到xyz中。现在我想访问xyz数据库表中的一些数据。我该怎么做?请帮帮我。
您可以在abc服务器上远程连接xyz数据库。如果你的数据库是mysql,那么你可以参考下面关于如何远程连接到mysql数据库的链接。
http://www.rackspace.com/knowledge_center/article/mysql-connect-to-your-database-remotely
Use the following configuration settings for connecting to your database
Host name = (use the xyz server IP address)
Database name = (xyz server database name)
Database username = (xyz database username)
Database password = (the password you entered for that database user on xyz)
MySQL Connection Port = 3306
假设xyz
站点具有IP 127.0.0.1(我知道它的本地主机,但只是一个示例),站点abc
具有IP 127..0.2。
您必须在站点xyz的数据库中授予访问权限,IP 127.0.0.2才能访问该数据库。
在abc站点上,您将需要IP 127.0.0.1而不是localhost。例如
$con = mysqli_connect("127.0.0.1","user","password","db");