I am trying to do the right thing (?) and not run MySQL as root all the time. So I have create a user 'jonathan'@'localhost' for which the following privileges are listed:
mysql> SHOW GRANTS FOR CURRENT_USER;
+-------------------------------------------------------------------------+
| Grants for jonathan@localhost |
+-------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'jonathan'@'localhost' |
| GRANT ALL PRIVILEGES ON `sampledb`.`sampledb` TO 'jonathan'@'localhost' |
+-------------------------------------------------------------------------+
2 rows in set (0.00 sec)
However, when I do:
mysql> use sampledb;
Database changed
Followed by:
mysql> CREATE TABLE Person (
-> id int NOT NULL AUTO_INCREMENT,
-> name VARCHAR(100),
-> address VARCHAR(200),
-> birthdate DATE,
-> PRIMARY KEY (id)
-> );
ERROR 1142 (42000): CREATE command denied to user 'jonathan'@'localhost' for table 'person'
It says CREATE command denied
as visible above. Why doesn't this work? Shouldn't I have 'ALL PRIVILEGES' and doesn't that include CREATE
?