如何在php中从一个网站连接到另一个网站的数据库

发布于 2024-09-05 13:49:19 字数 34 浏览 2 评论 0原文

如何在 php 中从一个网站连接到另一个网站的数据库?

How can I connect from one website to database of another website in php.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

宫墨修音 2024-09-12 13:49:20

您可以在 config.php 中或存储它们的位置添加连接详细信息,以及 another-website.com 或主机 URL 的 IP(您可能有 localhost ),然后是用户名和密码。

You add the connection details in config.php or where you store them, and another-website.com or the IP to the host url (You probably have localhost there), then the username and the password.

祁梦 2024-09-12 13:49:19

另一个网站将要求其端口开放供您连接。他们还需要数据库用户允许不仅仅来自本地计算机的连接。

如果您有相当标准的 LAMP 设置,这意味着在数据库服务器上打开端口 3306,以便可以进行外部连接,并且数据库用户设置将能够从外部世界进行连接。

请记住,它们可能是延迟问题。

The other website will require their port to be open for yours to connect to. They will also need the database user to allow connections that are not just from the local machine.

If you have a fairly standard LAMP set-up, this will mean opening port 3306 on the database server so outside connections can be made, and a database user setting up that will be able to connect from the outside world.

Bear in mind their may be latency issues.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文