首页 > 数据库 >【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库

【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库

时间:2023-08-10 20:33:01浏览次数:41  
标签:5.0 20 23 dbgrp 49 Jul Navicat omm openGauss

【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库

心有阳光 [openGauss](javascript:void(0);) 2023-08-03 16:49 发表于四川

收录于合集#第六届openGauss技术文章征集初审合格文章62个

引言

在当今互联网时代,数据成为企业和组织的重要资产。为了更好地管理和分析数据,数据库管理工具起到至关重要的作用。Navicat是一款广泛使用的数据库管理工具,具有直观友好的界面和丰富的功能,可以方便地连接、管理和操作各种类型的数据库。openGauss是一个领先的关系型数据库系统,提供高性能、高可用性和安全性,广泛应用于各个行业。

Navicat是一款跨平台的数据库管理工具,支持主流的数据库系统,如MySQL、PostgreSQL等。它提供了一个集成的环境,用于管理和操作多个数据库,可以执行数据导入导出、数据同步、查询和报表等功能。Navicat具有直观易用的用户界面和强大的功能,适用于数据库开发人员、管理员和分析师等各种角色。

openGauss是一款开源关系型数据库管理系统。它基于PostgreSQL,针对企业级应用进行了优化和改进。openGauss提供了高性能、高可用性和可扩展性,支持大数据和分布式计算。它还具有安全性和数据保护的特性,包括数据加密、访问控制和审计等功能。

环境准备

  • openGauss_5.0.0 企业版
  • Navicat 16.0.11
  • openEuler-22.03-LTS-SP2
  • MobaXterm 22.1
  • 服务器名称:node0,IP地址:192.168.192.129

openGauss服务设置

查看数据库启动状态

  • 切换至omm用户
[root@node0 ~]# su omm


Welcome to 5.10.0-153.12.0.92.oe2203sp2.x86_64

System information as of time:  Sat Jul 22 04:10:52 PM CST 2023

System load:    0.01
Processes:      170
Memory used:    5.5%
Swap used:      0%
Usage On:       7%
IP address:     192.168.192.129
Users online:   1
To run a command as administrator(user "root"),use "sudo <command>".
[omm@node0 root]$

【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库_数据库

  • 查看数据库启动状态
[omm@node0 root]$ gs_om -t status --detail
[   Cluster State   ]

cluster_state   : Unavailable
redistributing  : No
current_az      : AZ_ALL

[  Datanode State   ]

    node node_ip         port      instance                            state
--------------------------------------------------------------------------------------------
1  node0 192.168.192.129 15400      6001 /opt/huawei/install/data/dn   P Primary Manually stopped

【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库_PostgreSQL_02

  • 启动openGauss
[omm@node0 root]$ gs_om -t start
Starting cluster.
=========================================
[SUCCESS] node0
2023-07-22 16:21:31.942 64bb918b.1 [unknown] 139874136903616 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2023-07-22 16:21:31.942 64bb918b.1 [unknown] 139874136903616 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2023-07-22 16:21:31.945 64bb918b.1 [unknown] 139874136903616 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (3301 Mbytes) is larger.
=========================================
Successfully started.
# 停止openGauss
gs_om -t stop

【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库_IP_03

修改pg_hba.conf文件

企业版所在目录:/opt/huawei/install/data/dn

[omm@node0 dn]$ pwd
/opt/huawei/install/data/dn
[omm@node0 dn]$
[omm@node0 dn]$ ll
total 5044
drwx------ 6 omm dbgrp    4096 Jul 20 23:49 base
-rw------- 1 omm dbgrp    4399 Jul 20 23:48 cacert.pem
-rw------- 1 omm dbgrp      72 Jul 22 16:21 gaussdb.state
drwx------ 3 omm dbgrp    4096 Jul 22 16:21 global
-rw------- 1 omm dbgrp     354 Jul 20 23:49 gs_gazelle.conf
-rw------- 1 omm dbgrp 4915200 Jul 20 23:49 gswlm_userinfo.cfg
-rw------- 1 omm dbgrp   21016 Jul 20 23:49 mot.conf
drwx------ 2 omm dbgrp    4096 Jul 20 23:49 pg_clog
drwx------ 2 omm dbgrp    4096 Jul 20 23:49 pg_csnlog
-rw------- 1 omm dbgrp       0 Jul 22 16:21 pg_ctl.lock
drwx------ 2 omm dbgrp    4096 Jul 20 23:49 pg_errorinfo
-rw------- 1 omm dbgrp    4611 Jul 21 23:05 pg_hba.conf
-rw------- 1 omm dbgrp    4587 Jul 20 23:49 pg_hba.conf.bak
-rw------- 1 omm dbgrp    1024 Jul 20 23:49 pg_hba.conf.lock
-rw------- 1 omm dbgrp    1636 Jul 20 23:49 pg_ident.conf
drwx------ 4 omm dbgrp    4096 Jul 20 23:49 pg_llog
drwx------ 2 omm dbgrp    4096 Jul 20 23:49 pg_location
drwx------ 2 omm dbgrp    4096 Jul 22 16:24 pg_logical
drwx------ 4 omm dbgrp    4096 Jul 20 23:49 pg_multixact
drwx------ 2 omm dbgrp    4096 Jul 22 16:21 pg_notify
drwx------ 2 omm dbgrp    4096 Jul 20 23:49 pg_replslot
drwx------ 2 omm dbgrp    4096 Jul 20 23:49 pg_serial
drwx------ 2 omm dbgrp    4096 Jul 20 23:49 pg_snapshots
drwx------ 2 omm dbgrp    4096 Jul 22 16:25 pg_stat_tmp
drwx------ 2 omm dbgrp    4096 Jul 20 23:49 pg_tblspc
drwx------ 2 omm dbgrp    4096 Jul 20 23:49 pg_twophase
-rw------- 1 omm dbgrp       4 Jul 20 23:49 PG_VERSION
drwx------ 3 omm dbgrp    4096 Jul 20 23:49 pg_xlog
-rw------- 1 omm dbgrp   36058 Jul 21 23:07 postgresql.conf
-rw------- 1 omm dbgrp   36083 Jul 20 23:49 postgresql.conf.guc.bak
-rw------- 1 omm dbgrp    1024 Jul 20 23:49 postgresql.conf.lock
-rw------- 1 omm dbgrp      71 Jul 22 16:21 postmaster.opts
-rw------- 1 omm dbgrp      88 Jul 22 16:21 postmaster.pid
-rw------- 1 omm dbgrp       0 Jul 20 23:49 postmaster.pid.lock
-rw------- 1 omm dbgrp    4402 Jul 20 23:48 server.crt
-rw------- 1 omm dbgrp    1766 Jul 20 23:48 server.key
-rw------- 1 omm dbgrp      56 Jul 20 23:48 server.key.cipher
-rw------- 1 omm dbgrp      24 Jul 20 23:48 server.key.rand
drwx------ 5 omm dbgrp    4096 Jul 20 23:49 undo
[omm@node0 dn]$

【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库_IP_04

[omm@node0 dn]$ vi pg_hba.conf
  • 增加需要访问计算机的IP地址
  • 对所有IP地址进行开放:0.0.0.0/0
  • 修改trust替换成md5加密方式
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the PostgreSQL
# documentation for a complete description of this file.  A short
# synopsis follows.

......

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
host    all    omm    192.168.192.129/32    trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
host    all             all             192.168.192.129/32      md5
host    all             all             0.0.0.0/0               md5
# IPv6 local connections:
host    all             all             ::1/128                 trust

......
  • 输入 :wq! 退出

【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库_PostgreSQL_05

修改postgresql.conf文件

  • 修改监听地址和加密方式
[omm@node0 dn]$ vi postgresql.conf
# -----------------------------------------------------------------------------
#
# postgresql_single.conf.sample
#      Configuration file for centralized environment
#
# Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group

......

listen_addresses = '*'          # what IP address(es) to listen on;
                                        # comma-separated list of addresses;
                                        # defaults to 'localhost'; use '*' for all
                                        # (change requires restart)
local_bind_address = '192.168.192.129'
port = 15400                            # (change requires restart)
max_connections = 5000                  # (change requires restart)

......

#failed_login_attempts = 10             #Enter the wrong password reached failed_login_attempts times, the current account will be locked
password_encryption_type = 0            #Password storage type, 0 is md5 for PG, 1 is sha256 + md5, 2 is sha256 only
#password_min_length = 8                #The minimal password length(6-999)
#password_max_length = 32               #The maximal password length(6-999)
#password_min_uppercase = 0             #The minimal upper character number in password(0-999)
#password_min_lowercase = 0             #The minimal lower character number in password(0-999)
#password_min_digital = 0               #The minimal digital character number in password(0-999)
#password_min_special = 0               #The minimal special character number in password(0-999)
#password_effect_time = 90d             #The password effect time(0-999)
#password_notify_time = 7d              #The password notify time(0-999)

......

【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库_数据库_06

重启服务

[omm@node0 dn]$ gs_om -t stop
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.
[omm@node0 dn]$
[omm@node0 dn]$ gs_om -t start
Starting cluster.
=========================================
[SUCCESS] node0
2023-07-22 16:55:05.897 64bb9969.1 [unknown] 140297425711040 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2023-07-22 16:55:05.897 64bb9969.1 [unknown] 140297425711040 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2023-07-22 16:55:05.901 64bb9969.1 [unknown] 140297425711040 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (3301 Mbytes) is larger.
=========================================
Successfully started.

【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库_IP_07

创建远程连接角色

[omm@node0 dn]$ gsql -d postgres -p 15400
gsql ((openGauss 5.0.0 build a07d57c3) compiled at 2023-03-29 03:37:13 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

openGauss=# create user testuser password 'openGauss!666';
NOTICE:  The encrypted password contains MD5 ciphertext, which is not secure.
CREATE ROLE

【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库_PostgreSQL_08

防火墙开放端口

  • 防火墙为未启动状态,略过此步骤;
# 查看firewalld状态
systemctl status firewalld  		

# 把端口加入防火墙
firewall-cmd --zone=public --add-port=15400/tcp --permanent

# 重新加载防火墙
systemctl reload firewalld

Navicat连接

  • 打开Navicat,新建PostgreSQL连接方式;

【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库_PostgreSQL_09

  • 在“新建连接(PostgreSQL)”窗口中,输入连接名、主机IP地址、端口号、用户名、密码等参数
  • 端口号默认为5432,根据实际情况动态调整;

【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库_数据库_10

  • 点击“测试连接”按钮,提示连接成功,完成Navicat连接openGauss数据库;

【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库_数据库_11

【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库_IP_12

问题

fatal:forbid remote connection with initial user

【我和openGauss的故事】Navicat连接openGauss_5.0.0 企业版数据库_PostgreSQL_13

  • 在连接openGauss数据库时,提示:Forbid remote connection with initial user,意思是禁止用初始用户进行远程连接,即不要使用数据库默认的omm用户访问。

总结

本文就使用Navicat连接openGauss数据库的实践方法做了说明,在实际应用中,应根据实际情况进行调整和优化。

使用Navicat连接openGauss数据库,可以方便地进行数据管理和维护操作。可以轻松地执行数据导入导出、数据备份和恢复等任务。此外,Navicat还提供了强大的数据编辑功能,方便对数据库中的数据进行修改和更新。

附录

记录在openEuler-22.03中安装openGauss_5.0.0企业版

在VMware 17.0.2虚拟机中安装openEuler-22.03-LTS-SP2:https://www.modb.pro/db/1682365146923606016

标签:5.0,20,23,dbgrp,49,Jul,Navicat,omm,openGauss
From: https://blog.51cto.com/u_16191492/7039764

相关文章

  • 【我和openGauss的故事】openGauss 主备架构及同步复制模式理论学习与验证测试
    【我和openGauss的故事】openGauss主备架构及同步复制模式理论学习与验证测试尚雷[openGauss](javascript:void(0);)2023-08-0818:00发表于四川收录于合集#第六届openGauss技术文章征集初审合格文章62个备注:非常感谢在这研究本文相关内容中openGauss数据库官网行尘(张旭博)......
  • openGauss学习笔记-36 openGauss 高级数据管理-TRUNCATE TABLE语句
    openGauss学习笔记-36openGauss高级数据管理-TRUNCATETABLE语句清理表数据,TRUNCATETABLE用于删除表的数据,但不删除表结构。也可以用DROPTABLE删除表,但是这个命令会连表的结构一起删除,如果想插入数据,需要重新建立这张表。它和在目标表上进行无条件的DELETE有同样的效果,但由于......
  • openGauss数据库在CentOS上的安装实践
    本文分享自华为云社区《openGauss数据库在CentOS上的安装实践》,作者:Gauss小松鼠。1.安装前准备安装数据库前先要有已安装centOS7.6的服务器+数据库安装包。首先找小伙伴申请了华为云ECS服务器安装好了OS,这里使用的是x86_64+centos。华为云服务器现在可是很划算呢,安装也很方......
  • openGauss学习笔记-35 openGauss 高级数据管理-ALTER TABLE语句
    openGauss学习笔记-35openGauss高级数据管理-ALTERTABLE语句修改表,包括修改表的定义、重命名表、重命名表中指定的列、重命名表的约束、设置表的所属模式、添加/更新多个列、打开/关闭行访问控制开关。35.1语法格式在一张已经存在的表上添加列。ALTERTABLEtable_name......
  • Thinkphp 5.0.23 远程代码执行漏洞
    漏洞简介ThinkPHP是一款运用极广的PHP开发框架。在ThinkPHP5.0.23以前的版本中,获取method的方法中没有正确处理方法名,导致攻击者可以调用Request类任意方法并构造利用链,从而导致远程代码执行漏洞。漏洞复现开启vulhub靶场环境,确保ThinkPHP正常运行cdvulhub-master/thinkp......
  • Navicat Premium 15激活(永久激活,实测有效)
    NavicatPremium15永久激活教程准备工作在安装激活之前一定要确定安装的版本和对应的注册机版本对应,不然会导致激活码无法生效。之前我就是因为这个问题一直反复卸载重装浪费了很多的时间,你们进行安装激活时可以直接用我这里现成的NavicatPremium15和NavicatPremium15注册机注......
  • 【我和openGauss的故事】在vm中安装openEuler及使用yum安装openGauss
    【我和openGauss的故事】在vm中安装openEuler及使用yum安装openGauss手机用户0951[openGauss](javascript:void(0);)2023-08-0316:49发表于四川1.前言随着互联网时代对数据库的新要求,以PostgreSQL为基础的开源数据库openGauss应运而生。openGauss在保持PostgreSQL接口兼容的前......
  • 【我和openGauss的故事】openEuler20.03上编译安装opengauss-5.0.0
    【我和openGauss的故事】openEuler20.03上编译安装opengauss-5.0.0ziyoo0830[openGauss](javascript:void(0);)2023-08-0316:49发表于四川为了更好地学习openGauss数据库知识,有时候需要去调试源代码来深入了解一些东西。以下记录了在openEuler20.03上编译最新的openGauss-serve......
  • openGauss学习笔记-34 openGauss 高级数据管理-SCHEMA
    openGauss学习笔记-34openGauss高级数据管理-SCHEMASCHEMA又称作模式。通过管理SCHEMA,允许多个用户使用同一数据库而不相互干扰,可以将数据库对象组织成易于管理的逻辑组,同时便于将第三方应用添加到相应的SCHEMA下而不引起冲突。每个数据库包含一个或多个SCHEMA。数据库中的每个......
  • 如何通过navicat连接数据库修改EasyCVR视频监控管理平台的登录密码?
    TSINGSEE青犀视频监控管理平台EasyCVR可以根据不同的应用场景需求,让平台在内网、专网、VPN、广域网、互联网等各种环境下进行音视频的采集、接入与多端分发。在视频能力上,平台可实现视频实时直播、云端录像、云存储、回放与检索、告警上报、视频快照、视频转码与分发、平台级联等。......