opengauss 华为高斯数据库安装B-format 兼容mysql
opengauss 华为高斯数据库安装B-format 兼容mysql
opengauss是华为基于PostgreSQL魔改的数据库。本文介绍轻量版的安装。
安装包下载地址:https://opengauss.org/zh/download/
OpenGauss 5.x 安装
1.设置SEMMNI
如果不设置的话在安装过程中会报错 the maximum number of SEMMNI is not correct, the current SEMMNI is xxx. Please check it.
| vi /etc/sysctl.conf | 
2.新建用户和用户组
openGauss不能使用root用户
| #新增组gaussdbuser | 
3.下载安装包解压
通过wget或者上传工具上传安装压缩包
注意:在这一步需要通过非root用户的方式去执行,建议是使用刚刚创建的gaussdbuser
| #安装上传工具 install lrzsz | 
4.安装数据库
将gaussdbuser@123修改为密码后进行安装启动:
| echo gaussdbuser@123 | sh ./install.sh --mode single -D openGauss/data -R openGauss/install --start | 
最后的安装目录为/home/gaussdbuser/opengauss/openGauss/data/
5.修改配置
修改监听ip的配置和密码加密的方式,防止navicat无法连接。
修改 standard_conforming_strings 转义符,防止插入转义符被识别为字符串.
| vim data/pg_hba.conf | 
6.重启服务
注意启动需要gaussdbuser用户
| install/bin/gs_ctl restart -D data/ | 
数据库使用
gsql命令和常用sql
1.使用gaussdbuser用户连接数据库-本地登陆无需输入密码:
| install/bin/gsql -d postgres -p 5432 -r | 
2.查看用户信息
| \du | 
3.删除数据库
| drop database opengauss; | 
4.创建用户
| create user opengauss createrole password 'Opengauss@123'; | 
5.创建数据库 B模式即MySQL模式(一定要设置成B)
| CREATE DATABASE opengauss WITH dbcompatibility='B' OWNER=opengauss ENCODING='UTF-8'; | 
6.切换到数据库
| \c opengauss #切换到opengauss数据库 | 
7.创建SCHEMA,需切换到指定的数据库执行
| CREATE SCHEMA "opengauss" CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; | 
8.退出gsql
| \q | 
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Ahir's Blog!
 评论
GitalkDisqusjs
