使用navicat连接openGauss数据库

由于平时工作中使用 Navicat 比较多,数据库基本通过 Navicat 来管理操作。本文将介绍如何使用 Navicat 进行远程连接

openGauss 服务设置

主要修改 pg_hba.conf 和 postgresql.conf 两个文件。找到这两个文件所在目录

  • 极简版所在目录:/opt/software/openGauss/data/single_node/
  • 企业版所在目录:/opt/huawei/install/data/dn

注意:使用普通用户,不要使用 root 用户

修改 pg_hba.conf 文件

修改 pg_hba.conf 文件,主要用于添加放行 IP

  • 增加 Navicat 所在机器的 IP(如果不考虑安全性,也可以用 . ../0 对所有 IP 地址进行开放)

  • 修改 trust 替换成 md5 加密方式

    1.使用vim打开pg_hba.conf文件

    [omm@opengauss openGauss]$ vim /opt/software/openGauss/data/single_node/pg_hba.conf

    2.加入需要放行的IP,如图所示

    3.按esc键退出输入模式,输入:wq!退出

修改 postgresql.conf 文件

修改 postgresql.conf 文件,主要用于修改监听地址和加密方式

复制代码
# 1.使用vim打开postgresql.conf文件
[omm@opengauss openGauss]$ vim /opt/software/openGauss/data/single_node/postgresql.conf

# 2.修改监听地址listen_addresses = '*',如图所示
# 3.修改加密方式password_encryption_type = 0,如图所示

重启服务

企业版重启命令

复制代码
[omm@opengauss openGauss]$ gs_om -t stop
[omm@opengauss openGauss]$ gs_om -t start

极简版重启命令

复制代码
# 路径为pg_hba.conf和postgresql.conf所在目录
[omm@opengauss openGauss]$ gs_ctl restart -D /opt/software/openGauss/data/single_node/

创建远程连接角色

由于修改了加密方式,需要对用户之前的密码进行修改;或者创建新用户用于远程连接

复制代码
# 使用命令进入数据库
[omm@opengauss openGauss]$ gsql -d postgres -p 5432

# 修改密码方式
alter user test identified by '*********@***4'

# 创建新用户方式
 create user navicatuser password '*********@***4';

开放端口

复制代码
# 查看firewalld状态
[omm@opengauss openGauss]$ systemctl status firewalld

# 把端口加入防火墙
[omm@opengauss openGauss]$ sudo firewall-cmd --zone=public --add-port=5432/tcp --permanent

# 重新加载防火墙
[omm@opengauss openGauss]$ sudo systemctl reload firewalld
  1. 打开 navicat 点击新建连接选择 postgresSQL 连接
  1. 输入 ip、端口号等参数
相关推荐
NineData3 小时前
NineData 迁移评估功能正式上线
数据库·dba
NineData8 小时前
数据库迁移总踩坑?用 NineData 迁移评估,提前识别所有兼容性风险
数据库·程序员·云计算
赵渝强老师11 小时前
【赵渝强老师】PostgreSQL中表的碎片
数据库·postgresql
全栈老石15 小时前
拆解低代码引擎核心:元数据驱动的"万能表"架构
数据库·低代码
倔强的石头_1 天前
kingbase备份与恢复实战(二)—— sys_dump库级逻辑备份与恢复(Windows详细步骤)
数据库
jiayou643 天前
KingbaseES 实战:深度解析数据库对象访问权限管理
数据库
李广坤3 天前
MySQL 大表字段变更实践(改名 + 改类型 + 改长度)
数据库
爱可生开源社区4 天前
2026 年,优秀的 DBA 需要具备哪些素质?
数据库·人工智能·dba
随逸1775 天前
《从零搭建NestJS项目》
数据库·typescript
加号35 天前
windows系统下mysql多源数据库同步部署
数据库·windows·mysql