Mysql – DB user restricted permissions vs Docker

dockerMySQLpermissions

As far as I know, it's usually considered a good practice when developing websites to store in website config DB credentials of the user without ALTER/DROP permissions (so user may only select, insert, delete rows, but cannot modify DB structure).

But nowadays more and more sites using Docker for deployment and usually DB images like mysql:latest grant all permissions for the given database to the given user.

So my question is – should I manually go to MySQL DB as root during deployment and restrict the permissions or should I just keep it as is?

Best Answer

Given a brutal super user command or DROP TABLE / DROP DATABASE as likely to be the SQL injection commands for the malicious hacker, you may as well defend yourself against those. No point invoking a data recovery procedure pre-emptively.