[英]How to connect local MySQL database of another machine in same LAN?
I have question about how to connect local mysql db of another machine in same LAN. 我有关于如何在同一局域网中连接另一台机器的本地mysql数据库的问题。 The scenario is we have 2 machines in LAN:
情况是我们在局域网中有2台机器:
machine 1 :
IP : 127.0.0.1
local website name : https://127.0.0.1/demo_project1
mysql db name : demo1
machine 2 :
IP : 127.0.0.2
local website name : https://127.0.0.2/demo_project2
mysql db name : demo2
Can we do make db connection of https://127.0.0.1/demo_project1 to https://127.0.0.2/demo_project ie demo2? 我们可以将https://127.0.0.1/demo_project1的数据库连接建立到https://127.0.0.2/demo_project,即demo2吗? It means both machine will working on same database.
这意味着两台机器将在同一个数据库上工作。
Note : 注意 :
If the MySQL server is running in a machine which is connected to the same LAN where the second machine is connected, then you can access the MySQL server by specifying it's IP address. 如果MySQL服务器在连接到第二台计算机所连接的同一LAN的计算机上运行,则可以通过指定其IP地址来访问MySQL服务器。
You can find the IP (IPv4 address), by executing 'ifconfig' in the 'Command Prompt' (from the Start menu). 您可以通过在“命令提示符”(从“开始”菜单)中执行“ifconfig”来找到IP(IPv4地址)。
You can sync the data between the servers by creating a mysql dump and executing the same dump one the other server. 您可以通过创建mysql转储并在另一台服务器上执行相同的转储来同步服务器之间的数据。 You can automate this process using several MySQL client tools like SQLyog , MySQL Workbench, etc. which provides data sync option between two databases.
您可以使用SQLyog ,MySQL Workbench等几个MySQL客户端工具自动执行此过程,这些工具在两个数据库之间提供数据同步选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.