如何连接到另一台服务器上的数据库 [英] how to connect to database on another server

查看:26
本文介绍了如何连接到另一台服务器上的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在服务器 A 上安装我的 php 脚本并连接到服务器 B 上的 MySQL 数据库吗?

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

推荐答案

其简单 所有这些上面的技术都相当复杂

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

这篇关于如何连接到另一台服务器上的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆