简体   繁体   中英

Mysql grant all privileges to user

I have a problem, I created a database:

CREATE DATABASE laravel
                DEFAULT CHARACTER SET utf8
                COLLATE utf8_unicode_ci;

But when I try to grant privileges to user I receive a error syntax.

Could you help me with the correct syntax for mysql 8? Thanks

This is the problem:

 GRANT ALL ON laravel.*
           TO 'laraveluser'@'localhost'
           IDENTIFIED BY 'password';

mysql 8 has no ide4ntified by any more with GRANT

So you must use first CREATE USER and then GRANT

CREATE USER 'laraveluser'@'%' IDENTIFIED BY 'password';
GRANT ALL ON laravel.* TO 'laraveluser'@'localhost';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM