GBase 8s
其他
文章
南大通用GBase 8s 内部用户创建及使用
发表于2026-01-08 16:03:29326次浏览4个评论
本文将详细介绍如何在 GBase 8s 中创建普通用户,并展示如何为这些用户赋权以及如何使用这些用户连接数据库。通过本文你将能够顺利地完成用户创建、赋权和连接数据库的全过程。
探讨Gbase8S创建普通用户方法,直接执行
create user tmp_u001 with password 'GBase123';
可以吗?
> create user tmp_u001 with password 'GBase123';
26707: User (tmp_u001) cannot be created because the user is not mapped to any properties.
Error in line 1
Near character position 44
>显然直接创建不可以?
那需要怎么办呢?
下面介绍数据库普通用户的创建方法和使用。
1.首先创建操作系统用户,如useraaa1
useradd useraaa12.配置allowed.surrogates
在操作系统路径/etc/gbasedbt(如没有,使用root用户创建)下创建allowed.surrogates配置文件,并执行
echo "USERS:useraaa1" >> /etc/gbasedbt/allowed.surrogates注意新建的allowed.surrogates需要修改属组
chown root:gbasedbt /etc/gbasedbt/allowed.surrogates3.开启USERMAPPING
执行数据库命令
onmode -wf USERMAPPING=ADMIN
onstat -g cfg | grep USERMAPPING4.加载surrogates到缓存
onmode -cache surrogates5.在sysuser库中创建系统默认用户
database sysuser;
create default user with properties user useraaa1;6.到此就可以创建普通用户了,创建普通用户,可以接着上面操作,在sysuser库中接着执行,也可以重新开一个session执行。创建系统默认用户后,何处都可以创建普通用户!
dbaccess - -
create user tmp_u001 with password 'GBase123';
--或按下面方式创建,显示指定属性
create user 'tmp_u002' with password '123456' properties user 'useraaa1';7.给普通用户赋权
创建普通用户后,需要给该用户进行赋权,否则不能连接
dbaccess - -
Your evaluation license will expire on 2025-08-21 00:00:00
> connect to 'testdb@ol_gbasedbt1210_20240821112509' user 'tmp_u001';
ENTER PASSWORD:
387: No connect permission.
111: ISAM error: no record found.
Error in line 1
Near character position 1
>假如已存在root用户创建的库testdb,root用户执行如下语句
database testdb;
grant connect to tmp_u001;8.使用普通用户tmp_u001访问数据库,按提示输入密码
> !echo $GBASEDBTSERVER
ol_gbasedbt1210_20240821112509
> connect to 'testdb@ol_gbasedbt1210_20240821112509' user 'tmp_u001';
ENTER PASSWORD:
Connected.
> info tables;
Table name
t1
> select * from t1;
id
1
1 row(s) retrieved.
>至此,为创建普通用户的全过程,及赋权,连接使用!
如果在用户管理过程中遇到任何问题,欢迎随时在社区中提问,我们在这里为您提供支持!
评论
登录后才可以发表评论
热门帖子
- 12025-12-01浏览数:182759
- 22023-05-09浏览数:25052
- 42023-09-25浏览数:18521
- 52020-05-11浏览数:17526