創建數據庫 授權用戶
只對某一張表給user1用戶賦權查詢權限大約的步驟:
1,新建個數據庫賬號;
create user user1 with password 'GBase123';
2,在要授權的庫里(示例使用testdb),使用gbasedbt用戶回收所有表的public權限;
-- 所有的表
dbaccess testdb -;
revoke all on TABNAME from public;
或者使用下面的生成的腳本dbaccess testdb revoke.sql
3,授予用戶usre1訪問庫及表的權限;
dbaccess testdb -
grant connect to testdb;
\-- 所有的表都執行
grant select on TABNAME to user1;
============================================================================================
如果要對數據庫中所有的表給user1用戶只賦權select權限的操作步驟如下:
1,新建個數據庫賬號user1(首先登錄到對應的數據庫里面,例如testdb數據庫);
dbaccess testdb -
create user user1 with password 'GBase123';
grant connect to user1;
2, 生成回收權限語句及授權語句
dbaccess testdb -
unload to revoke.sql delimiter ';'
select 'revoke all on ' || tabname || ' from public'
from systables
where tabid > 99
and tabtype = 'T';
unload to grant.sql delimiter '; '
select 'grant select on ' || tabname || ' to user1'
from systables
where tabid > 99
and tabtype = 'T';
3,執行回收權限和賦權只能查詢的語句(使用gbasedbt用戶)
dbaccess testdb revoke.sql
dbaccess testdb grant.sql
執行完上面兩個語句后用戶user1就只有select權限了

浙公網安備 33010602011771號