MySQL: Grant **all** privileges on database

后端 未结 11 1300
庸人自扰
庸人自扰 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 10:19

     1. Create the database

    CREATE DATABASE db_name;
    

     2. Create the username for the database db_name

    GRANT ALL PRIVILEGES ON db_name.* TO 'username'@'localhost' IDENTIFIED BY 'password';
    

     3. Use the database

    USE db_name;
    

     4. Finally you are in database db_name and then execute the commands like create , select and insert operations.

提交回复
热议问题