xampp - 从 LAN 内的另一台本地计算机连接到本地数据库

发布于 2024-09-13 00:09:41 字数 282 浏览 3 评论 0原文

我正在使用 XAMPP 创建 php 项目。 我的系统是:name=con7 本地ip=192.168.1.20 另一个系统是: name=con12 和本地 ip=19.168.1.10

我想从 con7 连接到 con12 中的数据库。

我读到我们需要为尝试从不同机器连接的主机(ip)提供访问权限,例如cPanel->数据库(Linux主机的控制面板)中的访问主机。

我可以访问该系统,因为那个人(con7)负责数据输入,而我负责操作。 类似的事情。

那么如何做到这一点呢?

I am using XAMPP to create php projects.
My system is: name=con7 and local ip=192.168.1.20
Another system is: name=con12 and local ip=19.168.1.10

I want to connect to a database in con12 from con7.

I read that we need to provide access permission for the host(ip) which is trying to connect from a different machine like the Access Host in cPanel->databases (the control panel for linux hostings).

I have access to that system as that person(con7) does the data entry and me the manipulation.
some thing like that.

So how to do this?

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

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

发布评论

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

评论(1

千紇 2024-09-20 00:09:41

为了连接到远程数据库,您必须确保:

  • mysql 服务器必须侦听公共接口(例如 eth0),以便可以通过 LAN 访问。这可以通过端口 3306(默认 mysql 端口)上的 telnet 进行检查
  • 必须允许 mysql 用户至少从 192.168.1.20 或 %(即所有主机)进行连接
  • mysql 用户必须具有读(+写)权限数据库

您想运行 PHP 脚本吗?在 mysql_connect() 中添加正确的凭据就足够了。如果您想使用本地 phpmyadmin 来处理数据库,您必须在 phpmyadmin-config 中添加数据库。

希望有帮助。

In order to connect to a remote database you have to make sure:

  • The mysql-server has to listen on a public interface (e.g. eth0) in order to be accessable via lan. This can be checked via telnet on port 3306 (default mysql port)
  • The mysql-user must be allowed to connect at least from 192.168.1.20 or % (i.e. all hosts)
  • The mysql-user must have read (+write) permissions for the database

Do you want to run an PHP-script adding the correct credentials in mysql_connect() should suffice. If you want to use your local phpmyadmin to work with the database you have to add the database in the phpmyadmin-config.

Hope that helps.

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