从Php脚本

时间:2015-12-14 17:52:04

标签: php mysql

我有两个网站(与Cpanel分开管理)。我想在另一个主机上使用数据库。

域及其mysql端口为:abc.com:2082和xyz.com:2082。

我想在xyz.com上运行的Php脚本中使用abc.com上的数据库。但是,当我尝试连接到数据库时,连接显示错误:“错误”。

1 个答案:

答案 0 :(得分:0)

Well, You can do it in two ways first connecting database using database credential. in that case, you need to enable mysql remote permission . if provide % then anyone from any ip address can connect with your database.

Secondly, You can use restful api to exchange data in between. to know more about restful api search in the stackoverflow.