Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a difference between (local), '.' and localhost?

I've used all three of these when making local programmatic connections to databases. Is there any real difference between them?

like image 387
Chris Sutton Avatar asked Oct 01 '08 00:10

Chris Sutton


People also ask

Is localhost the same as local IP?

Localhost is a hostname that refers to the local machine currently making the request. On many computers, localhost is an alias for the IP address 127.0. 0.1. When a computer pings this IP address, it is communicating with itself.

Is 127.0 0.1 and localhost the same?

Localhost is often considered synonymous with the IP address 127.0. 0.1.

What is difference between host and localhost?

Definition: Localhost: “Localhost refers to the local computer that a program is running on”. Webhosting: “In order to publish a website online, you need a Web host. The Web host stores all the pages of your website and makes them available to computers connected to the Internet”.

When should I use localhost?

What is localhost used for? Developers use the local host to test web applications and programs. Network administrators use the loopback to test network connections. Another use for the localhost is the host's file, where you can use the loopback to block malicious websites.


1 Answers

The final result is the same. The difference is:

  • 'localhost' resolves at the TCP/IP level and is equivalent to the IP address 127.0.0.1
  • Depending on the application "(local)" could be just an alias for 'localhost'. In SQLServer, '(local)' and '.' mean that the connection will be made using the named pipes (shared memory) protocol within the same machine (doesn't need to go through the TCP/IP stack).

That's the theory. In practice, I don't think there is substantial difference in performance or features if you use either one of them.

like image 65
Sergio Acosta Avatar answered Sep 23 '22 05:09

Sergio Acosta