MySQL Multiple Database Setup

后端 未结 4 2054
滥情空心
滥情空心 2021-01-14 22:43

I\'ve searched for an answer to this and all I can seem to find are questions asking whether it is better to use multiple databases or multiple tables in a single database.

4条回答
  •  天命终不由人
    2021-01-14 23:13

    You can grant access to different database to different user using GRANT in MySQL.

    https://dev.mysql.com/doc/refman/5.1/en/grant.html has the information you need.

    The most simple you can do is

    CREATE DATABASE db_for_user_a
    CREATE DATABASE db_for_user_b
    GRANT ALL PRIVILEGES ON db_for_user_a.* TO user_a IDENTIFIED BY 'user_a_s_password'
    GRANT ALL PRIVILEGES ON db_for_user_b.* TO user_a IDENTIFIED BY 'user_b_s_password'
    

提交回复
热议问题