Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
    
+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 0:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.