MYSQL: What is the pros of using 'user' on mysql as opposed to 'root'? Why do we create new user on mysql?

chu-js :

Someone told me that it is better for me to use 'user' compared to the 'root' account of mysql. I'm not sure if they're actually talking about sudo. Can someone breakdown the differences in mysql users for me please? Thanks!

Barmar :

The root user has total access to the database. If you make a mistake you can easily destroy large amounts of data.

Using different users allows you to implement more fine-grained access control. Users can be given access to specific databases and tables, and permission to perform different operations. You can have users that are only allowed to SELECT, while other users can UPDATE, DELETE, and/or INSERT.

This limits the amount of damage they can do if something goes wrong.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=237908&siteId=1