-1

I created a new db in WAMP, and I note that under the 'Privileges' tab that list the users I have one user that I didn't create, named 'root'. What is it? It is listed twice, once under 'localhost' and once under '127.0.0.1'. I understand that this is the address for 'localhost', but why list it twice? Also, I created a user, 'admin', and it appears under 'localhost', but not 127.0.0.1'. I'd like to understand why.

Shane Madden
  • 114,520
  • 13
  • 181
  • 251
JDelage
  • 211
  • 1
  • 4
  • 9

1 Answers1

4

In MySQL, the root user is a system default. What the users are "appearing under" is the host specification for the user; this allows controlling of the devices that a user is able to log in from. Oftentimes this can be restricted to a single device (as in your case, since the web server is on the same system), but in other cases remote access is needed from different location/network or a number of locations; this would require different host specifications.

The system default root account is specified with localhost and 127.0.0.1 as a failsafe for when the skip-name-resolve option is used in the configuration; in that case, the localhost specification is useless and root would be unable to log in without the 127.0.0.1 entry.

Shane Madden
  • 114,520
  • 13
  • 181
  • 251
  • +1 Very good and simple explaination. I've always wondered why there was a localhost and 127.0.0.1 entry... :) – Kyle Smith May 19 '11 at 00:58