我们可以获得 MySQL 服务器的只读连接吗?或者默认将 autocommit 设置为 false ?
最近,我的一位同事弄乱了我们的一个数据库。因此我想知道有没有办法从MySQL Workbench
获得到MySQL Server
的只读连接?如果没有,有没有办法让我们默认将 autocommit
设置为 false
(0
) ?
编辑: 问题是有时同一用户必须对数据库进行一些修改,而且我不是系统管理员来更改此类权限。 :) 当我们使用开发环境时,会发生这种混乱,但由于某种原因打开了与生产环境的连接,比如查看表或表中的数据,然后忘记切换回生产环境开发选项卡。
Recently a colleague of mine messed up with one of our databases. Hence I would like to know that is there a way to get a read-only connection to the MySQL Server
from the MySQL Workbench
? If not, is there a way by which we can set the autocommit
to false
(0
) by default?
EDIT:
The problem is sometimes the same user has to make some modifications to the DB and also, I am not the System Admin to change such permissions. :) This sort of mess up happens when we are working with development environment, but due to some reason open a connection to production environment, say to have a look at a table or data in a table, and then just forget to switch back to development tab.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
设置将用于不具有
UPDATE
/INSERT
权限的用户的权限。Set the permissions on the user that will be used to not have
UPDATE
/INSERT
permissions.为两个单独的连接创建两个用户。通常使用的连接具有只读访问权限。另一个仅在进行编辑时使用,然后立即断开连接。并非万无一失,但话又说回来,没有什么是万无一失的。
Create two users for two seperate connections. The connection that is normally used would have read only access. The other would be used only when making edits, then disconnected immediately. Not foolproof, but then again, nothing is.