Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Mysql is showing 5 root users:

| root   | %         |
| root   | |
| root   | ::1       |
| root   | localhost |
| root   | mysrverhostname |

What are these 5 for? Are there some I can delete?

share|improve this question
up vote 3 down vote accepted

| root | % | - This is the root user from any computer
| root | | - This is the root user for localhost without resolved IP for IPv4
| root | ::1 | - This is the root user for localhost without resolved IP for IPv6
| root | localhost | - This is the root user for localhost with resolved IP
| root | mysrverhostname | - This is the root user if you connect from the localhost to its externel IP.

You could the delete the first one if you don't like to connect from another computer to this server as root.

All other root users are useful, because you can do the follow types of mysql connections:

  • mysql -h -u root (IPv4)
  • mysql -h ::1 -u root (IPv6)
  • mysql -h localhost (If the mysql server is configured to resolve IPs, the the 2 above would get used)
  • mysql -h -u root (the IP of the server)
  • mysql -h mysqlserver.local -u root (the hostname of the server)

and if I remember correctly the "localhost" user get used if you connect using a socket connection.

share|improve this answer
correct on your "localhost" assumption on unix-like systems – Shlomi Noach Feb 22 '14 at 16:02
@Harald Leithner : for the sake of clarity, could all these "root"access possibilities cause a security issue? – Mel Feb 22 '14 at 16:46
By default the root user has all permissions, so its not the best idea to let this user get access from all computers on earth. Same thing like let "root" login per ssh. I rename the "root" user to a different name. – Harald Leithner Feb 22 '14 at 17:08
@Harald-Leithner :thank you for your help – Mel Feb 23 '14 at 6:25

Your Answer


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.