Duplicate users in mysql.user

I just did SELECT Host, User, Password FROM mysql.user; and I get the following results:

+ ------------------------------------- + ---------- + ------------------------------------------- +
| Host | User | Password |
+ ------------------------------------- + ---------- + ------------------------------------------- +
| localhost | root | * CFB0F01E12976D94C46201145940E3EF71E32742 |
| my_name_goes_here-MacBook-Pro.local | root | * CFB0F01E12976D94C46201145940E3EF71E32742 |
| 127.0.0.1 | root | * CFB0F01E12976D94C46201145940E3EF71E32742 |
| :: 1 | root | * CFB0F01E12976D94C46201145940E3EF71E32742 |
| localhost | | |
| my_name_goes_here-MacBook-Pro.local | | |
| % | testuser | * 00E247AC5F9AF26AE0194B41E1E769DEE1429A29 |
+ ------------------------------------- + ---------- + ------------------------------------------- +

How to delete these duplicate entries? (I can also see the previous version of mysql (5.5.8) on my hard drive)

+5
source share
1 answer

No duplicate entries. There is one line for each Host / User combination. But if you need to remove it, look at DROP USER

Addition for answer

This query will show you that empty users have a name ':

SELECT Host, User, Password FROM mysql.user WHERE User LIKE '';

, :

DROP USER ''@'localhost';
DROP USER ''@'my_name_goes_here-MacBook-Pro.local';

, . , , , .

+7

All Articles