2

I'm running command grant all privileges on *.* to 'username'@localhost identified by 'strong password';, but I get the error:

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 'strong password'' at line 1.

I can add a user separately and then assign it the privileges on the database, but I'd like to add the user and assign privileges in a single command. MySQL version:

| version                  | 8.0.23-0ubuntu0.20.04.1       |
| version_comment          | (Ubuntu)                      |
| version_compile_machine  | x86_64                        |
| version_compile_os       | Linux                         |
| version_compile_zlib     | 1.2.11                        |
0
4

GRANT has no option for password anymore in mysql 8 see manual

CREATE USER 'username'@'localhost' IDENTIFIED BY 'strong password';
GRANT ALL ON *.* TO 'username'@'localhost';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.