The difference between localhost and 127.0.0.1 is localhost127.0.0.1. The difference between localhost and 127.0.0.1: localhost127.0.0.1 opened a new server today. when the code was moved, the database could not be connected. after reading it, the configuration was changed from 12 localhost to 127.0.0.1. localhost127.0.0.1
Today, I opened a new server. when the code was moved, the database could not be connected. I looked at it and changed the configuration from 127.0.0.1 to localhost. Let's take a look at the differences below.
Many people will access this IP address 127.0.0.1. Maybe you will ask 127.0.0.1 what is the address? In fact, 127.0.0.1 is a return address, which refers to a local machine and is generally used for testing. We usually use pinging 127.0.0.1 to check whether the local ip address or tcp address is abnormal. if you can ping 127.0.0.1, the local ip address or tcp address can be used properly.
In most cases, localhost is used to point to the local IP address 127.0.0.1. There is a configuration file in the operating system that binds localhost with 127.0.0.1. It can be understood as the meaning of the local host.
What is the difference between localhost and 127.0.0.1?
I believe some people will say it is a local ip address. some people once said that 127.0.0.1 is better than localhost, and it can reduce resolution once.
It seems that some people are not clear about this issue. In fact, there are differences between the two.
Localhost is also called local. the correct explanation is: local Server
127.0.0.1 in windows and other systems, the correct explanation is: Local Address (local server)
Their parsing uses the host file of the local machine, and windows automatically resolves localhost to 127.0.0.1
Localhot (local) is transmitted without a nic! This is important because it is not restricted by network firewalls and network adapters.
127.0.0.1 is transmitted through the NIC and depends on the NIC. it is subject to network firewall and Nic restrictions.
Generally, it is best to use localhost for local services when setting a program. localhost will not be resolved to an ip address, nor will it occupy Nic or network resources.
Sometimes you can use localhost, but you cannot use 127.0.0.1. this is the case. Assume that when localhost is accessed, the current user's permission on the local machine is granted by the system. when ip is used, the local machine accesses the local machine through the network, which may involve the permissions of network users.
Reference: http://blog.csdn.net/xifeijian/article/details/12879395
Pipeline opened a new server today. when the code was moved, the database could not be connected. after reading it, the original configuration was changed from 12...