Bug #17864 | create new database without permissions | ||
---|---|---|---|
Submitted: | 2 Mar 2006 15:21 | Modified: | 7 Mar 2006 8:41 |
Reporter: | Marcel Haertel | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.0.27-BK, 4.0.26 | OS: | Linux (Linux, freebsd) |
Assigned to: | CPU Architecture: | Any |
[2 Mar 2006 15:21]
Marcel Haertel
[2 Mar 2006 15:45]
Valeriy Kravchuk
Thank you for a (possibly, known) bug report. I was able to repeat the behaviour you described with 4.0.27-BK build on Linux: openxs@suse:~/dbs/4.0> bin/mysql -uroot test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 to server version: 4.0.27 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> grant all on DB_C_bla.* to user1@'localhost' identified by 'user1'; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye openxs@suse:~/dbs/4.0> bin/mysql -uuser1 -p test Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10 to server version: 4.0.27 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show databases; +----------+ | Database | +----------+ | DB_C_bla | | test | +----------+ 2 rows in set (0.00 sec) mysql> create database `DB?C?bla`; Query OK, 1 row affected (0.00 sec) mysql> show databases; +----------+ | Database | +----------+ | DB?C?bla | | DB_C_bla | | test | +----------+ 3 rows in set (0.00 sec) mysql> drop database `DB?C?bla`; Query OK, 0 rows affected (0.00 sec) mysql> show databases; +----------+ | Database | +----------+ | DB_C_bla | | test | +----------+ 2 rows in set (0.00 sec) mysql> create database anyotherone; ERROR 1044: Access denied for user: 'user1@localhost' to database 'anyotherone' mysql> create database `t?st`; ERROR 1044: Access denied for user: 'user1@localhost' to database 't?st'
[2 Mar 2006 16:01]
Marcel Haertel
this is reproducible under mysql 4.1.18
[7 Mar 2006 8:41]
Valeriy Kravchuk
Sorry, but this misleading behaviour is not a bug. It is clearly documented in the manual (http://dev.mysql.com/doc/refman/4.1/en/grant.html): "Note: the ‘_’ and ‘%’ wildcards are allowed when specifying database names in GRANT statements that grant privileges at the global or database levels. This means, for example, that if you want to use a ‘_’ character as part of a database name, you should specify it as ‘\_’ in the GRANT statement, to prevent the user from being able to access additional databases matching the wildcard pattern; for example, GRANT ... ON `foo\_bar`.* TO ...." You (and me) got what we asked for. Sorry again about improper verification - my fault.