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

标签 php mysql codeigniter cpanel

我有两个服务器,分别是 abc.comxyz.com。在 abc.com 上,我创建了一个数据库。我想访问 xyz.com 中的这个数据库。

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

提前致谢

最佳答案

我认为您应该首先阅读有关为您的 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

关于php - 在一台服务器上创建Mysql主机并从另一台服务器访问数据库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47039662/

相关文章:

php - SQL INSERT INTO 表结果重复

mysql - 无法发现这两个查询之间的区别

PHP 编写一个价格比较工具

php - 使用 codeigniter 更新/更改数据库中的值

php - ftp_ssl_connect 与隐式 ftp over tls

c# - 声明连接变量

javascript - 选择...从...使用 Ajax 的位置

python - 内存高效的内置 SqlAlchemy 迭代器/生成器?

javascript - javascript 文件中的 Codeigniter( Controller )文件路径

php - CodeIgniter 500 内部服务器错误