暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

openGauss每日一练第6天 | 学习💯

原创 Power 2022-11-29
161

课后作业

1.创建用户user1,分别在数据库musicdb1、数据库musicdb2创建表t11,t12

su - omm
gsql -r
create user user1 identified by 'kunpeng@1234';
create database musicdb1;
create database musicdb2;
ALTER USER user1 SYSADMIN;
\c musicdb1 user1
create table t11(id int);
insert into t11 values(11);
\c musicdb2 user1
create table t12(id int);
insert into t12 values(12);



2.user1用户连接到数据库musicdb1,并访问数据库musicdb1下的表t11

\c musicdb1 user1
select * from t11;


3.在这个连接中(使用数据库用户user1连接到数据库musicdb1)访问数据库musicdb2下的t12表(会报错)

select * from t12;


4.使用数据库用户user1连接到数据库musicdb2,访问数据库musicdb2下的t12表。

\c musicdb2 user1
select * from t12;


课后拓展

单节点安装

  1. 创建用户组dbgroup。

    groupadd dbgroup
    
  2. 创建用户组dbgroup下的普通用户omm,并设置密码为Gauss_234 。

    useradd -g dbgroup omm
    passwd Gauss_234
    
  3. 使用omm用户登录到openGauss包安装的主机,解压openGauss压缩包到安装目录(假定安装目录为/opt/software/openGauss,请用实际值替换)。

    tar -jxf openGauss-x.x.x-openEuler-64bit.tar.bz2 -C /opt/software/openGauss
    
  4. 假定解压包的路径为/opt/software/openGauss,进入解压后目录下的simpleInstall。

    cd /opt/software/openGauss/simpleInstall
    
  5. 执行install.sh脚本安装openGauss。

    sh install.sh  -w xxxx
    

    上述命令中,-w是指初始化数据库密码(gs_initdb指定),安全需要必须设置。

  6. 安装执行完成后,使用ps和gs_ctl查看进程是否正常。

    ps ux | grep gaussdb
    gs_ctl query -D /opt/software/openGauss/data/single_node
    

    执行ps命令,显示类似如下信息:

    omm      24209 11.9  1.0 1852000 355816 pts/0  Sl   01:54   0:33 /opt/software/openGauss/bin/gaussdb -D /opt/software/openGauss/single_node
    omm      20377  0.0  0.0 119880  1216 pts/0    S+   15:37   0:00 grep --color=auto gaussdb
    

    执行gs_ctl命令,显示类似如下信息:

    gs_ctl query ,datadir is /opt/software/openGauss/data/single_node
    HA state:
        local_role                     : Normal
        static_connections             : 0
        db_state                       : Normal
        detail_information             : Normal
    
    Senders info:
        No information
    
     Receiver info:
    No information


「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论