You see MySQL thinks you're ''
, not root
, which is related to this warning from the manual:
If you permit anonymous users to connect to the MySQL server, you should also grant privileges to all local users as user_name@localhost. Otherwise, the anonymous user account for localhost in the mysql.user table (created during MySQL installation) is used when named users try to log in to the MySQL server from the local machine. For details, see Section 6.2.4, “Access Cotrol, Stage 1: Connection Verification”.
“Access Cotrol, Stage 1: Connection Verification” states:
The server uses sorting rules that order rows with the most-specific Host values first
That means if you have an anonymous ''@localhost
user, but a less specific (or just sorted later) root@'%'
(or something like it) definition never matches because the 'anonymous' rule matches. Look through that last link for a more thorough explanation.
What this means is you either:
- GRANT access to
root@localhost
explicitly. DROP USER ''@'localhost';
(the anonymous user)
I would highly recommend the second one: you should have no need for an anonymous user.