I just ran this in MySQL 5.6.15 on my Windows 8 machine
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.15 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select user(),current_user();
+----------------+----------------+
| user() | current_user() |
+----------------+----------------+
| ODBC@localhost | @localhost |
+----------------+----------------+
1 row in set (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (0.05 sec)
mysql>
Then, I logged into MySQL as redwards@localhost
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.15 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select user(),current_user();
+--------------------+--------------------+
| user() | current_user() |
+--------------------+--------------------+
| redwards@localhost | redwards@localhost |
+--------------------+--------------------+
1 row in set (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql>
What is the difference? An anonymous user can still execute SHOW DATABASES; but can only see information_schema (contains metadata only anonymous users can see). Why can the database test be seen? The table mysql.db allows test databases to be visible to everyone (See my question MySQL : Why are there "test" entries in mysql.db? and the answer I posted)
SHOW DATABASES;and see the list of databases? Or does it return nothing (but no error)? Please add the output ofSHOW GRANTS;while logged in as the user in question (as opposed toSHOW GRANTS FOR...). Also please includeSELECT @@VERSION;. – Michael - sqlbot Jan 19 '14 at 16:07SHOW DATABASES;still shows the list of databases. Updated the post. – iridescent Jan 20 '14 at 02:21