MySql grant user permission

后端 未结 4 1914
既然无缘
既然无缘 2021-01-06 08:58

I want to create a new user in MySql. I do not want that new user to do much with my existing databases [I just want to grant Select privilege to him], but he can do anythin

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-06 09:37

    From the MySQL grant documentation:

    CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';
    GRANT SELECT ON *.* TO 'jeffrey'@'localhost';
    GRANT ALL ON db1.* TO 'jeffrey'@'localhost';
    

    The first command creates the user. The second grants select on all databases and tables. The third command grants all access to all tables in db1.

    Is there anything else specific you are looking to do?

提交回复
热议问题