简体   繁体   中英

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. The scenario is we have 2 machines in LAN:

     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? It means both machine will working on same database.

Note :

  1. we have install on Xampp server on both machines.
  2. we can access https://127.0.0.2/demo_project2 of machine 2 from machine 1.

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.

You can find the IP (IPv4 address), by executing 'ifconfig' in the 'Command Prompt' (from the Start menu).

You can sync the data between the servers by creating a mysql dump and executing the same dump one the other server. You can automate this process using several MySQL client tools like SQLyog , MySQL Workbench, etc. which provides data sync option between two databases.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM