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

后端 未结 3 621
夕颜
夕颜 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.

    0 讨论(0)
  • 2020-12-18 19:58

    The password field is what that particular user's password is when logging into MySQL itself. I'm not exactly sure what you mean when you say you wonder what privileges are missing. What exactly are you trying to do?

    0 讨论(0)
  • 2020-12-18 20:16

    Absolutely you can. http://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html#priv_create

    0 讨论(0)
提交回复
热议问题