Comment 1 for bug 1302376

Revision history for this message
Pradeep Kumar Chandani (pradeep-chandani) wrote :

This is invalid bug...as in Mysql, user can be granted on databases which doesn't exits.

Find below queries for reference-

mysql> show databases;
+---------------------+
| Database |
+---------------------+
| information_schema |
| debdb2 |
| #mysql50#lost+found |
| mysql |
| performance_schema |
| test |
| testdb |
| testdb1 |
| testdb3 |
+---------------------+
9 rows in set (0.69 sec)

mysql> select User,Host from mysql.user;
+------------------+-----------+
| User | Host |
+------------------+-----------+
| @Db#$jai123 | % |
| debuser2 | % |
| jai | % |
| jai$@ | % |
| debian-sys-maint | localhost |
| os_admin | localhost |
| root | localhost |
+------------------+-----------

mysql> Grant ALL ON debdb2333.* TO 'debuser2@%' ;
Query OK, 0 rows affected (0.01 sec)

mysql> select grantee,table_schema from information_schema.SCHEMA_PRIVILEGES where privilege_type != 'USAGE' group by grantee , table_schema;
+-------------------+--------------+
| grantee | table_schema |
+-------------------+--------------+
| ''@'%' | test |
| ''@'%' | test\_% |
| '@Db#$jai123'@'%' | db |
| 'debuser2'@'%' | db1 |
| 'debuser2@%'@'%' | debdb2 |
| 'debuser2@%'@'%' | debdb211 |
| 'debuser2@%'@'%' | debdb2333 |
| 'jai$@'@'%' | db |
| 'jai'@'%' | adf |
| 'jai'@'%' | asdf |
| 'jai'@'%' | db |
| 'jai'@'%' | debdb22 |
| 'jai'@'%' | sdf |
+-------------------+--------------+
13 rows in set (0.02 sec)

So from above queries we can see that if we fire grant queries for database that dont exits, it gives the grants the access of that database to user even that database doesn't exists.