在一台服务器上创建Mysql主机并从另一台服务器访问数据库?

时间:2017-10-31 15:59:39

标签: php mysql codeigniter cpanel

我有两个服务器abc.comxyz.com。在abc.com我创建了一个数据库。我想在xyz.com中访问此数据库。

我在123.123.123.123上创建了远程主机abc.com。但不知道下一步。

提前致谢

1 个答案:

答案 0 :(得分:0)

我认为您应首先阅读有关为cPanel / WHM服务器配置远程mysql服务器的cPanel / WHM文档: https://documentation.cpanel.net/display/ALD/Remote+MySQL

As a basic guideline the steps would be as follow:
- create a mysql database in a cPanel's user account
- create a mysql username and password for that database
- grant rights to that user for that database
- add the ip address of the mysql remote host you want to use
- check your server firewall and be sure that you grant access to mysql (tcp port 3306) to that ip address;
- from the remote host try doing a **telnet cpanel-server-ip 3306** and see if you can connect