简体   繁体   English

具有选择权限的MySQL用户仍然可以更新

[英]MySQL User with select privileges can still update

I have an OpenShift app with a MySQL database that I configured an ODBC connection for, such that users can use Access as a read only front end to the tables. 我有一个带有MySQL数据库的OpenShift应用程序,该数据库配置了ODBC连接,以便用户可以将Access用作表的只读前端。 I created such a user, but they are able to update data from the Access front end and it is reflected in the database. 我创建了这样的用户,但他们能够从Access前端更新数据,并且该数据已反映在数据库中。 Here's what I did: 这是我所做的:

I created a user named 'reports', to be given read only access to only one schema, 'reviews'. 我创建了一个名为“ reports”的用户,该用户被授予对一个模式“ reviews”的只读访问权限。

GRANT SELECT ON reviews.* TO reports@'%' IDENTIFIED BY `password`;

When I run 当我跑步

SELECT * FROM mysql.user WHERE user = 'reports';

I get all N's and 0's. 我得到所有N和0。 I understand there's no 'Y' for "Select_priv" because it's not a global select priv, only on one schema, so I figured it was okay. 我知道“ Select_priv”没有“ Y”,因为它不是全局选择priv,仅在一个模式下,所以我认为这还可以。

When I run 当我跑步

SHOW GRANTS FOR 'reports'@'%';

I get 我懂了

GRANT USAGE ON . 允许使用 TO 'reports'@'%' IDENTIFIED BY PASSWORD 'stringstringstring' 由密码“ stringstringstring”标识为“报告” @“%”
GRANT SELECT ON 'reviews'.* TO 'reports'@'%'; 允许选择“评论”。*为“报告” @“%”;

Which I expected. 这是我所期望的。

SELECT * FROM db where User = 'reports';

|Host|Db |User |Select_priv|Insert_priv|Update_priv|... |主机| Db |用户| Select_priv | Insert_priv | Update_priv | ...
|% |reviews|reports|Y |N |N |... |%|评论|报告|是| N | N | ...

But when I go into Access, edit some data, then ssh into the database and view the database, the UPDATES are working. 但是当我进入Access时,编辑一些数据,然后ssh进入数据库并查看数据库,UPDATES就可以了。

I am using rhc port-forward -a applicationname before I connect in Access, and I use rhc ssh applicationname to view the MySQL from the server. 在连接Access之前,我正在使用rhc port-forward -a applicationname ,并且我使用rhc ssh applicationname从服务器查看MySQL。

There is a bug in Access where if you feed it a Data Source, then try to change it, it won't actually let go of your initial Data Source even though it has appeared to. Access中有一个错误,如果您将其提供给数据源,然后尝试对其进行更改,则即使它看起来已经出现,它实际上也不会释放您的初始数据源。 I had initially set my Access DB up with an All Privileges account, then changed the Data Source to a read only account, but it continued to use my All Access account behind the scenes. 我最初使用All Privileges帐户设置了Access DB,然后将数据源更改为只读帐户,但是它仍然在后台使用我的All Access帐户。 Deleting the Data Source using odbcad32.exe proved this, as I just got connection errors, even though it said I was connected via my valid Read Only account. 使用odbcad32.exe删除数据源证明了这一点,因为我刚刚遇到连接错误,即使它说我是通过有效的只读帐户连接的。 I created a new Access DB using the Read Only data source from the beginning and it worked as expected. 我从一开始就使用Read Only数据源创建了一个新的Access DB,它可以按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM