mysql - Can't find any matching row in the user table -


i trying execute queries -

drop database if exists `hotel`;  grant usage on *.* 'user'@'localhost'; drop user 'user'@'localhost';  create user user@localhost identified 'user';  create database `hotel`     character set 'utf8'     collate 'utf8_general_ci';  grant usage on *.* 'user'@'localhost' identified 'user'; 

but error on

grant usage on *.* 'user'@'localhost' error code: 1133. can't find matching row in user table    0.000 sec 

i thought grant usage create new user if user not exist. wrong?

i thought grant usage create new user if user not exist. wrong?

from documentation, can set option allow mysql create user if not exist.

no_auto_create_user

prevent grant statement automatically creating new users if otherwise so, unless nonempty password specified.

to set option:

you can change sql mode @ runtime using set [global|session] sql_mode='modes' statement set sql_mode system value.


Comments