如何连接到数据库中的另一个服务器上数据库中、连接到、器上

2023-09-11 10:19:59 作者:摆渡翁

我可以对服务器A上我的PHP脚本,并连接到MySQL数据库服务器B上?

Could I have my php scripts on server A and connect to the MySQL database on server B?

如果是,它将如何做?在此先感谢

If yes, how it would be done? Thanks in advance

推荐答案

其简单的全thise上述技术是相当复杂的。

its simple all thise above techniques are quite complicated

假设你有服务器B和网站服务器A上的数据库(说它IP 192.234.12.1)

suppose you have database on server B and website on server A(say it has IP 192.234.12.1)

上的cPanel白名单服务器B的IP

on cpanel whitelist the IP of server B

和创建数据库具有足够权限的新用户(比如这个用户测试)

and create a new user having sufficient privileges in database (say this user is test)

然后建立这个用户为test@192.234.12.1

then create this user as test@192.234.12.1