I have a MySQL user, which we’ll call Tom. Tom has global CREATE and SHOW DATABASES privileges, with the ‘GRANT’ option.
The user is assigned SELECT, INSERT, UPDATE and DELETE privileges on a per-database basis. However, after Tom creates a new database, he can’t set his SELECT etc. privileges, despite having a global GRANT option.
The error is (predictably) :
CREATE DATABASE `my_new_db`; -- this is fine
GRANT SELECT , INSERT , UPDATE , DELETE ON `my_new_db` . * TO 'Tom'@'%';
*Access denied for user 'Tom'@'%' to database 'my_new_db'*
This is being done via PHP, but I doubt that makes much difference.
Someone tell me what I’m doing wrong! Ta =]
You can’t grant privileges you don’t have. Tom needs to have global SELECT, INSERT, UPDATE, and DELETE privileges in order to grant them to others.