--给管理员角色赋予权限: grant all privileges on readers to admin grant all privileges on books to admin grant select on rb to admin这个赋予权限出现错误应该怎么解决
时间: 2024-03-24 08:36:15 浏览: 101
这个错误可能是由于 rb 表不存在而导致的,因为在语句中出现了 rb 表,但并未在语句中创建。
如果您确定 rb 表已经存在,可以尝试使用以下语句授权:
```
grant all privileges on readers to admin;
grant all privileges on books to admin;
grant select on rb to admin;
```
如果 rb 表不存在,您需要先使用 CREATE TABLE 语句创建 rb 表,例如:
```
create table rb (
id int primary key,
reader_id int,
book_id int,
borrow_date datetime,
return_date datetime
);
```
然后再使用授权语句进行授权。
相关问题
hive执行GRANT ALL PRIVILEGES ON *.* TO <admin_user> WITH GRANT OPTION;
在 Hive 中,GRANT 语句用于授予用户对指定数据库或表的权限。与 MySQL 不同的是,Hive 不支持在 GRANT 语句中使用 *.* 来授予所有数据库和表的权限,因此你需要指定具体的数据库和表。
以下是一个授予用户在所有数据库和表上拥有所有权限的示例 Hive GRANT 语句:
```
GRANT ALL PRIVILEGES ON DATABASE <database_name> TO <admin_user> WITH GRANT OPTION;
```
如果你想授予对特定表的权限,可以使用以下语法:
```
GRANT <permission> ON TABLE <table_name> TO <user>[, <user2>, ...] [WITH GRANT OPTION];
```
其中,<permission> 可以是 SELECT、INSERT、UPDATE、DELETE 或 ALL,代表不同的操作权限。在 WITH GRANT OPTION 选项的帮助下,你可以允许被授权的用户将这些权限授予其他用户。
CREATE USER cedar IDENTIFIED BY cedar DEFAULT TABLESPACE CEDAR_DATA TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK; -- 5 Roles for cedar GRANT DBA TO cedar; GRANT RESOURCE TO cedar WITH ADMIN OPTION; GRANT AQ_ADMINISTRATOR_ROLE TO cedar; GRANT CONNECT TO cedar WITH ADMIN OPTION; GRANT AQ_USER_ROLE TO cedar; ALTER USER cedar DEFAULT ROLE ALL; -- 44 System Privileges for cedar GRANT CREATE ANY DIRECTORY TO cedar WITH ADMIN OPTION; GRANT CREATE PUBLIC SYNONYM TO cedar WITH ADMIN OPTION; GRANT EXECUTE ANY CLASS TO cedar WITH ADMIN OPTION; GRANT DROP ANY VIEW TO cedar WITH ADMIN OPTION; GRANT CREATE CLUSTER TO cedar; GRANT ALTER SYSTEM TO cedar; GRANT UPDATE ANY TABLE TO cedar; GRANT INSERT ANY TABLE TO cedar; GRANT LOCK ANY TABLE TO cedar; GRANT CREATE EXTERNAL JOB TO cedar WITH ADMIN OPTION; GRANT EXECUTE ANY PROGRAM TO cedar WITH ADMIN OPTION; GRANT CREATE JOB TO cedar WITH ADMIN OPTION; GRANT DROP ANY DIRECTORY TO cedar WITH ADMIN OPTION; GRANT ALTER ANY TRIGGER TO cedar; GRANT CREATE DATABASE LINK TO cedar; GRANT DROP ANY TABLE TO cedar WITH ADMIN OPTION; GRANT CREATE TABLE TO cedar WITH ADMIN OPTION; GRANT QUERY REWRITE TO cedar; GRANT ANALYZE ANY TO cedar; GRANT DROP ANY TRIGGER TO cedar; GRANT EXECUTE ANY PROCEDURE TO cedar; GRANT SELECT ANY TABLE TO cedar WITH ADMIN OPTION; GRANT ALTER ANY TABLE TO cedar; GRANT UNLIMITED TABLESPACE TO cedar WITH ADMIN OPTION; GRANT CREATE SESSION TO cedar; GRANT CREATE ANY TRIGGER TO cedar; GRANT DROP ANY PROCEDURE TO cedar WITH ADMIN OPTION; GRANT ALTER ANY PROCEDURE TO cedar; GRANT DROP PUBLIC SYNONYM TO cedar WITH ADMIN OPTION; GRANT DROP ANY SYNONYM TO cedar WITH ADMIN OPTION; GRANT MANAGE SCHEDULER TO cedar WITH ADMIN OPTION; GRANT CREATE ANY PROCEDURE TO cedar; GRANT CREATE PROCEDURE TO cedar WITH ADMIN OPTION; GRANT CREATE SEQUENCE TO cedar; GRANT CREATE VIEW TO cedar WITH ADMIN OPTION; GRANT CREATE SYNONYM TO cedar; GRANT DROP ANY INDEX TO cedar; GRANT DELETE ANY TABLE TO cedar; GRANT CREATE ANY TABLE TO cedar; GRANT CREATE ANY JOB TO cedar WITH ADMIN OPTION; GRANT SELECT ANY DICTIONARY TO cedar WITH ADMIN OPTION; GRANT CREATE ROLE TO cedar; GRANT CREATE ANY SYNONYM TO cedar WITH ADMIN OPTION; GRANT ALTER SESSION TO cedar WITH ADMIN OPTION; GRANT EXECUTE ON sys.dbms_aq TO cedar; GRANT EXECUTE ON sys.dbms_aqadm TO cedar; GRANT EXECUTE ON sys.dbms_network_acl_admin TO cedar; GRANT ALL ON sys.DBMS_LOCK TO cedar; 这个SQL在oracle 能用吗
这个 SQL 语句应该是可以在 Oracle 环境中执行的。它的作用是创建一个名为 cedar 的用户,并指定了该用户的默认表空间、临时表空间、角色和权限等信息。其中,该用户被授予了 DBA、RESOURCE、AQ_ADMINISTRATOR_ROLE、CONNECT、AQ_USER_ROLE 等角色,也被授予了 44 个系统权限(如 CREATE ANY DIRECTORY、EXECUTE ANY CLASS、CREATE TABLE 等)。此外,该用户还被授予了一些特殊的权限,如 EXECUTE ON sys.dbms_aq、EXECUTE ON sys.dbms_aqadm、EXECUTE ON sys.dbms_network_acl_admin 等。这些权限和角色的授予将使得该用户具有较高的系统权限,需要谨慎使用。
阅读全文