Take the 2-minute tour ×
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. It's 100% free, no registration required.

I found this in my local MySQL installation today:

mysql> select host, user from user;
+--------------+---------+
| host         | user    |
+--------------+---------+
| ::1          | root    |
| ... others...| etc.    |
+--------------+---------+

What is the host ::1? Should I delete it? I only need to log in from localhost.

share|improve this question
add comment

2 Answers 2

up vote 8 down vote accepted

::1 Localhost is the equivalent to 127.0.0.1 Localhost but using IPv6 protocol format

to clarify further:

:: is an abbreviation for zeros, so this entry really means

0000:0000:0000:0000:0000:0000:0000:0001 localhost
share|improve this answer
add comment

That is the IPV6 representation of 127.0.0.1

I wrote an earlier post on this.

MySQL 5.5 started embedding this upon initial installation. It's OK to leave it if you assign 'root'@'::1' a password. If you do not want it to have a password, then you can drop that user.

@Jakub mentioned the direct answer first, so he gets a +1 from me !!!

If you want to remove it, you could run either

DROP USER 'root'@'::1';

or

DELETE FROM mysql.user WHERE user='root' AND host='::1';
FLUSH PRIVILEGES;

If you are using only root@localhost and want to eliminate all other root users, do this:

DELETE FROM mysql.user WHERE user='root' AND host<>'localhost';
FLUSH PRIVILEGES;
share|improve this answer
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.