-1

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?

jonalv
  • 5,706
  • 9
  • 45
  • 64

2 Answers2

0

Did you flush privileges after the grant statement?

Moazzam Khan
  • 49
  • 1
  • 2
0

Have you flushed MySQL's privileges after the GRANT by running the following command?

FLUSH PRIVILEGES;
Ian Brindley
  • 2,197
  • 1
  • 19
  • 28
  • yes I have done that – jonalv Dec 05 '16 at 16:29
  • I actually don't think I would be able to do `SHOW GRANTS FOR CURRENT_USER` if not cause then it wouldn't show up there I guess? Also, the fact that I could log in at all I take as indicating that the flushing worked... – jonalv Dec 05 '16 at 16:30