How to connect to a local host from another computer

I am making a database program and use localhost as the host. I want my friend to test my program, but I don’t know how to connect from another computer.

PS. I am using Windows 7 and MySql.

+5
source share
4 answers

localhost is just an alias for loopback address 127.0.0.1, which means this computer.

If you want to communicate with this computer from another place, you will need to use its real IP address.

For example, see the following “diagram” showing where the connections will go, depending on the IP address used:


    +-----------+ 10.1.1.8 +-----------+
    | MyPC      | <------- | YourPC    |
    |           |          |           |
    | 10.1.1.8  | -------> | 10.1.1.9  |
    +-----------+ 10.1.1.9 +-----------+
      |       ^              |       ^
      |       |              |       |
    127.0.0.1-+            127.0.0.1-+

Windows IP- ipconfig (ifconfig UNIX-) , localhost.

, IP- , , ( 10.1.1.8):

GRANT ALL PRIVILEGES ON *.* TO 'mysql'@'10.1.1.8' IDENTIFIED BY 'super-sekrit'
+6

? "localhost" IP-, .

+1

? IP- . , , NAT, ip-. NAT-,

+1
source

Localhost is the standard host name assigned to the loopback network interface address. for communication between two computers:

  • Use the IP address of your system.
  • first make sure your system can be sent from your PC with friends.
  • make sure that the appropriate port that your application is listening on is open.
0
source

All Articles