![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, I just install MySQL server on Linux and want to configure users. The mysql.user table says I have the root users: root (AT) 127 (DOT) 0.0.1 root@localhost Which one can I safely remove? My /etc/hosts file has localhost as 127.0.0.1. Also, I only want local access to the server for all users. Again, should I create user joe (AT) 127 (DOT) 0.0.1 or joe@localhost? Thank you, Joe |
#3
| |||
| |||
|
|
On 25-11-10 17:44, Joe Hesse wrote: Hello, I just install MySQL server on Linux and want to configure users. The mysql.user table says I have the root users: root (AT) 127 (DOT) 0.0.1 root@localhost Which one can I safely remove? My /etc/hosts file has localhost as 127.0.0.1. Also, I only want local access to the server for all users. Again, should I create user joe (AT) 127 (DOT) 0.0.1 or joe@localhost? Thank you, Joe I would keep 'localhost' beacuse it always translates to the loopback IP address 127.0.0.1 in IPv4, or ::1 in IPv6.[2] [ref:http://en.wikipedia.org/wiki/Localhost ] |
#4
| |||
| |||
|
|
On Thu, 25 Nov 2010 18:47:21 +0100, Luuk wrote: On 25-11-10 17:44, Joe Hesse wrote: Hello, I just install MySQL server on Linux and want to configure users. The mysql.user table says I have the root users: root (AT) 127 (DOT) 0.0.1 root@localhost Which one can I safely remove? My /etc/hosts file has localhost as 127.0.0.1. Also, I only want local access to the server for all users. Again, should I create user joe (AT) 127 (DOT) 0.0.1 or joe@localhost? Thank you, Joe I would keep 'localhost' beacuse it always translates to the loopback IP address 127.0.0.1 in IPv4, or ::1 in IPv6.[2] [ref:http://en.wikipedia.org/wiki/Localhost ] No, it doesn't. localhost refers to the connection through the OS socket, not the loopback network socket. "Localhost" would map to 127.0.0.1 on the network, but localhost in all lower case means something entirely different and special to mysql. |
#5
| |||
| |||
|
|
After reading the replies I think I have the answer. When you connect to a server, e.g. http, using a domain name, the client resolves the name and then connects to the server. |
|
The server also sees the domain name. In the case of MySQL, the domain name is checked against the data in mysql.user and MySQL rejects the login if the domain name isn't there. Specifically if you do: 1. mysql -h 192.168.0.30 vs. 2. mysql -h mylocaldomain, where mylocaldomain resolves to 192.168.0.30, the connection will be refused in 2. if mylocaldomain is not in mysql.user even if 192.168.0.30 is. |
|
When you connect to MySQL with localhost, it sees the connection attempt as coming from the domain name localhost. |
#6
| |||
| |||
|
|
When you connect to MySQL with localhost, it sees the connection attempt as coming from the domain name localhost. |
|
from doing http://localhost where the web browser resolves the name to 127.0.0.1 even though the web server sees the name localhost |
#7
| |||
| |||
|
|
I just install MySQL server on Linux and want to configure users. The mysql.user table says I have the root users: root (AT) 127 (DOT) 0.0.1 root@localhost Which one can I safely remove? My /etc/hosts file has localhost as 127.0.0.1. Also, I only want local access to the server for all users. Again, should I create user joe (AT) 127 (DOT) 0.0.1 or joe@localhost? |
#8
| |||
| |||
|
|
I just install MySQL server on Linux and want to configure users. The mysql.user table says I have the root users: root (AT) 127 (DOT) 0.0.1 root@localhost Which one can I safely remove? My /etc/hosts file has localhost as 127.0.0.1. Also, I only want local access to the server for all users. Again, should I create user joe (AT) 127 (DOT) 0.0.1 or joe@localhost? |
#9
| |||
| |||
|
|
Joe Hesse<JoeHesse (AT) gmail (DOT) com> writes: When you connect to MySQL with localhost, it sees the connection attempt as coming from the domain name localhost. Not quite. The client *does* treat the name localhost differently, but when it sees it, it connects through a local domain socket, not through TCP/IP. Also note that, from the perspective of the client, the connection attempt isn't "coming from" anything - the client is *making* the attempt by *sending* it to the server. The server, when it receives a connection request from the local domain socket, authorizes it by looking for permissions from "localhost." from doing http://localhost where the web browser resolves the name to 127.0.0.1 even though the web server sees the name localhost The difference is that the web browser doesn't treat localhost differently than any other name - it looks up an address for it, just like it would do for any other machine name. It's an unfortunate design choice, made way back when, because localhost has long been synonymous for 127.0.0.1, but where MySQL is concerned, it means something entirely different. :-( sherm-- |
![]() |
| Thread Tools | |
| Display Modes | |
| |