mysqldatabase-connectiondatabase-permissions

sql open connection in read only mode


Suppose a user has full read/write access to MySQL database. Is there any way (some parameter in connection string) to connect to database by the same username and password in read-only mode?

I want this without changing this user's permissions because the same user might require write permission too at some other time. This would be useful (if possible) to prevent accidental modification to database.


Solution

  • The best solution here is to create another account on the mysql server with readonly permissions, and connect using that.