1

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.

Mathieu Longtin
  • 273
  • 2
  • 12

1 Answers1

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.

Mathieu Longtin
  • 273
  • 2
  • 12