简体   繁体   中英

Multiple mysql users for different roles in one db

I was just wondering if it is safer to have different users for different tasks in a db. For example: One user in one php file with the permission to select One user in another php file with permission to select and update

That way, if a hacker somehow got access to the first user through the first php file, he/she would only be able to select.

Is it better to just use one user that can select and update?

It is generally best practice to have the minimum permission set required to perform any database task.

It is also best practice to not store usernames/passwords in the .php file. Instead store them in a configuration file outside of your version control.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM