Roberto
Roberto

Reputation: 809

in mysql, how can a user create owner database and write in?

i all

i was able to assign privilege to create new database to a user with

root> GRANT CREATE ON *.* TO 'newuser'@'localhost';
newuser> create database newdb;
newuser> Query OK, 1 row affected (0.00 sec)

now, i would that the newdb just created by 'newuser' was writable by newuser itself.

newuser> CREATE TABLE newtable ( id INT );
Query OK, 0 rows affected (0.00 sec)
newuser> INSERT INTO newtable (id) VALUES (1);
ERROR 1142 (42000): INSERT command denied to user 'offique'@'localhost' for table 'newtable'

i try to set privileges (with same user...) without solution :-(

newuser> GRANT ALL PRIVILEGES ON newdb.* TO 'newuser'@'localhost';
ERROR 1044 (42000): Access denied for user 'newuser'@'localhost' to database 'newdb'

any idea?

many thanks!

Upvotes: 2

Views: 5031

Answers (1)

Devart
Devart

Reputation: 121922

now, i would that the newdb just created by 'newuser' was writable by newuser itself.

In this case it is enought to give an INSERT privilege on database level -

GRANT INSERT ON *.* TO 'newuser'@'localhost';

You should grant it from the 'root' account, because your new user has no rights to do it itself.


GRANT INSERT ON newdb.* TO 'newuser'@'localhost';

Upvotes: 1

Related Questions