1

I got the "triggers cannot be created on system tables" error while running my trigger and looked online on how to fix this and one solution was to grant the user privileges to the schema. Now I am doing that but mysql is saying that I have a syntax error on line 1 near 'localhost'.This is my query and Im basing this off of the MySQL website. Can somebody tell me what wrong so I can run my trigger?

CREATE USER 'root' @ 'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON mysql.* TO 'root' @ 'localhost';

1 Answers1

0

The first query is redundant. root should already exist in your database and therefore you will not need to create it. Hence the error after removing the spaces.

The second query will not change anything as root should have all privileges on mysql by default. So you do not need to grant root all privileges to mysql.*

Run the following to grant your personal account all privileges:

GRANT ALL PRIVILEGES ON mysql.* TO 'username'@'localhost';
  • That worked on granting me privilege but I still get the error "Triggers can not be created on system tables" – Diego Delgado Oct 26 '17 at 02:25
  • You can not create triggers on system tables. As stated on this post it's a "bitter truth" https://stackoverflow.com/a/13430059/5535323 – eckertalex Oct 26 '17 at 02:29