I am trying to add an existing user to another database but I am keep getting the error:
ERROR 1410 (42000): You are not allowed to create a user with GRANT
I tried the following, none worked:
GRANT ALL ON db.* TO 'user'@'localhost';
GRANT ALL ON db.* TO 'user'@'localhost' WITH GRANT OPTION;
GRANT ALL ON db.* TO 'user';
I am using MySQL on digitalocean
MySQL version: 8.0.31-0ubuntu2
Update: I am using root
user.
2
Answers
According to this oracle blog, it is not possible to create a user from the GRANT command in mysql 8:
It states you have to create a user first, before granting privileges. Have you created the user first? If not, try that!
You need to create a user 1st. Follow the below steps.
CREATE USER 'username'@'host' IDENTIFIED WITH authentication_plugin BY 'password';
or
CREATE USER 'sammy'@'localhost' IDENTIFIED BY 'password';
if the 1st command throws an error.GRANT PRIVILEGE ON database.table TO 'username'@'host';
FLUSH PRIVILEGES;
You can find the full reference in this blog