1

I am trying to follow this tutorial for MySQL & JDBC:

http://www.vogella.com/tutorials/MySQLJava/article.html

I have to execute this command on the command line client:

grant usage on *.* to sqluser@localhost identified by 'sqluserpw';

I then get this 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 'sqluserpw'' at line 1

My MySQL server version is 8.0.13, but I can not find any information about what is wrong with my syntax. I have checked similar threads here, but they don't answer this question.

treyBake
  • 6,440
  • 6
  • 26
  • 57
  • 1
    remove the `identified by` - I swear this never worked for me. I tend to just use `GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' WITH GRANT OPTION;` – treyBake Nov 29 '18 at 09:21
  • 1
    just edit user and change password that way instead of with setting permissions – treyBake Nov 29 '18 at 09:22
  • 1
    As treyBake already implied: the syntax you are using is no longer valid for MySQL 8, see e.g. [here](https://stackoverflow.com/a/50197630). – Solarflare Nov 29 '18 at 10:26
  • This solved it for me:CREATE USER 'foo'@'localhost' IDENTIFIED WITH mysql_native_password BY 'bar'; GRANT ALL PRIVILEGES ON database_name.* TO'foo'@'localhost'; Thanks SolarFlare ! – Eyvind Almqvist Nov 29 '18 at 14:39

0 Answers0