Answer the question
In order to leave comments, you need to log in
What's wrong with the grant command?
I don’t understand where I messed up, mb who will see?
mysql> GRANT REPLICATION SLAVE ON *.* TO 'root'@'%' IDENTIFIED BY my_password;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY my_password' at line 1
mysql> GRANT REPLICATION SLAVE ON *.* TO 'root'@'%';
ERROR 1410 (42000): You are not allowed to create a user with GRANT
mysql> GRANT REPLICATION SLAVE ON *.* TO 'root'@'%' IDENTIFIED BY 'my_password';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY 'my_password'' at line 1
mysql> GRANT REPLICATION SLAVE ON *.* TO 'admin'@'%' IDENTIFIED BY 'my_password';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY 'my_password'' at line 1
Answer the question
In order to leave comments, you need to log in
In MySQL 8, it was forbidden to automatically create a user with the GRANT command.
Now you need to first explicitly create a user with the command:
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'secret';
GRANT REPLICATION SLAVE ON *.* TO 'myuser'@'localhost';
The first error was 100% due to the fact that the password is not wrapped in quotes, and the second is not enough rights to create users using GRANT.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question