Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm baffled. I have a select only user, but somehow, the user can create a new database, and create table inside the new database. It can't create tables inside other db. It's really odd.

This is MariaDB 5.5.28.

$ mysql -upermtest -pxxx -h mysqlhost
...
Your MySQL connection id is 4355 to server version: 5.5.28-MariaDB-log
...
mysql> show grants;
+----------------------------------------------------------------------------------------------------------+
| Grants for permtest@%                                                                                    |
+----------------------------------------------------------------------------------------------------------+
| GRANT SELECT ON *.* TO 'permtest'@'%' IDENTIFIED BY PASSWORD '*XXX' |
+----------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> create database test_ddb_again;
Query OK, 1 row affected (0.00 sec)

mysql> use test_ddb_again;
Database changed

mysql> create table hello ( a int );
Query OK, 0 rows affected (0.01 sec)

mysql> use previously_existing_db;
Database changed

mysql> create table hello ( a int );
ERROR 1142 (42000): CREATE command denied to user 'permtest'@'10.30.25.51' for table 'hello'
mysql>

I'm sure there is a good explanation for this.

share|improve this question
    
Check this: MySQL : Why are there “test” entries in mysql.db? –  ypercube Dec 13 '12 at 16:42
    
Yup. I was creating databases starting with test_. –  Mathieu Longtin Dec 13 '12 at 16:50
    
Rolando advises how to get rid of this issue (and vulnerability) –  ypercube Dec 13 '12 at 16:52
add comment

1 Answer 1

After reading this (thanks @ypercube)

MySQL : Why are there "test" entries in mysql.db?

I removed the test entries from mysql.db and it fixed it. I then realized that all the test I'd ran were using database named like test_xxx. Creating database with a name not beginning in 'test_' was not working as expected.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.