What permission is required for a MySQL user to create a database?

后端 未结 3 635
夕颜
夕颜 2020-12-18 19:25

Is it possible for a user other than root to create a database?

 GRANT SELECT, CREATE ON *.* TO \'myguy\'@\'thatmachine\' IDENTIFIED BY PASSWORD \'*12057DFA2         


        
3条回答
  •  春和景丽
    2020-12-18 19:58

    As Izkata and Evan Donovan have mentioned in the comments, the best way to achieve this is to give myguy all privileges on the database myguy_%.

    You can do this with the following sql:

    grant all privileges on 'myguy_%'.* to myguy@localhost identified by 'password';
    

    This way you don't have to bother with other existing databases, and myguy is able to create new databases to his heart's content.

提交回复
热议问题