If your CURRENT_USER() does not say root@localhost
, then you do not have root privileges and not being allowed to connect as such.
To see what actual privileges you do have after getting connected, run this
SHOW GRANTS;
When you connect to a specific database, you should be able to see
- the tables of that database
- metadata in the INFORMATION_SCHEMA for just that database
Let's say, for example, you connected to buyspace_systdb
The output from SHOW GRANTS;
would most likely appear something like this
GRANT USAGE ON *.* ...
GRANT ALL PRIVILEGES ON buyspace_systdb.* TO ...
The user root@localhost
would work if you login from within that local server. If you are logging in remotely, root@localhost
would not allow USER() to authenticate as CURRENT_USER(). The proof of this is in the first display in your question. Note that you can only see information_schema. It will virtually empty with the exception of information_schema.schemata which would have 1 or 2 entries. If root@'%'
existed in mysql.user
and had the same privileges as root@localhost
, then it would be allowed to see everything like root@localhost
.
MySQL has an authentication scheme that has a downward spiral effect. If the user you try to connect with does not exist, it will try usernames that are more vague ( allowing for wildcards or limited privileges ). See my DBA StackExchange post MySQL error: Access denied for user 'a'@'localhost' (using password: YES) for further details on this.
Bottom Line: You cannot connect as root@localhost
from a remote location
SELECT USER() AttemptedToConnectAsUser,CURRENT_USER() AllowedToConnectAsUser;
What is the output ???