MySQL: Grant **all** privileges on database

后端 未结 11 1189
庸人自扰
庸人自扰 2020-11-22 09:23

I\'ve created database, for example \'mydb\'.

CREATE DATABASE mydb CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER \'myuser\'@\'%\' IDENTIFIED BY PASSWORD          


        
11条回答
  •  伪装坚强ぢ
    2020-11-22 09:55

    To grant all priveleges on the database: mydb to the user: myuser, just execute:

    GRANT ALL ON mydb.* TO 'myuser'@'localhost';
    

    or:

    GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'localhost';
    

    The PRIVILEGES keyword is not necessary.

    Also I do not know why the other answers suggest that the IDENTIFIED BY 'password' be put on the end of the command. I believe that it is not required.

提交回复
热议问题