测试了一下,use db 之后执行 SQL 就可以了
mysql> show grants;
+--------------------------------------------+
| Grants for User |
+--------------------------------------------+
| GRANT USAGE ON *.* TO 'mss'@'%' |
| GRANT ALL PRIVILEGES ON db1.* TO 'mss'@'%' |
| GRANT ALL PRIVILEGES ON db2.* TO 'mss'@'%' |
+--------------------------------------------+
3 rows in set (0.04 sec)
mysql> delete from db1.a as A where exists(select 1 from db2.b as B where A.id = B.id);
ERROR 8121 (HY000): privilege check fail
mysql> use db1;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> delete from db1.a as A where exists(select 1 from db2.b as B where A.id = B.id);
Query OK, 0 rows affected (0.20 sec)
mysql> use db2;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> delete from db1.a as A where exists(select 1 from db2.b as B where A.id = B.id);
Query OK, 0 rows affected (0.09 sec)
mysql> select tidb_version();
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v4.0.9
Edition: Community
Git Commit Hash: 69f05ea55e8409152a7721b2dd8822af011355ea
Git Branch: heads/refs/tags/v4.0.9
UTC Build Time: 2020-12-21 04:26:49
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.27 sec)
不过这个行为跟 MySQL 不一致。
1 个赞
谢谢~~~ 可以了。
1 个赞
此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。