sql以只读模式打开连接 [英] sql open connection in read only mode

查看:56
本文介绍了sql以只读模式打开连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题出于好奇.我在Google上搜索了此内容,但没有任何线索.

This question comes out of curiosity. I searched google for this but didn't get a clue.

假设用户具有对MySQL数据库的完全读/写访问权限.我想知道,是否有任何方式(连接字符串中的某些参数)以只读模式使用相同的用户名和密码连接到数据库?

Suppose a user has full read/write access to MySQL database. I am wondering, 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.

推荐答案

这里最好的解决方案是在mysql服务器上创建一个具有只读权限的帐户,然后使用该帐户进行连接.

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

这篇关于sql以只读模式打开连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆