centos7 安裝postgres資料庫

2021-09-26 18:54:59 字數 1187 閱讀 4627

部落格位址

github

$ yum install -y
# 先檢視postgresql源

$ yum list|grep postgresql

# 安裝

$ yum install postgresql10-contrib postgresql10-server -y

$ /usr/pgsql-10/bin/postgresql-10-setup initdb
$ systemctl start postgresql-10

$ systemctl enable postgresql-10.service

# 切換到postgres使用者

$ su postgres

# 進入

$ psql -u postgres

# 設定密碼

$ alter user postgres with password '密碼';

退出:\q

備註其他:列出所有庫\l 列出所有使用者\du 列出庫下所有表\d

$ vi /var/lib/pgsql/10/data/pg_hba.conf

### 再type database下增加一條

host all all 0.0.0.0/0 md5

$ vi /var/lib/pgsql/10/data/postgresql.conf

# 修改listen_address = ''

listen_address = '*'

# 重啟生效

$ systemctl restart postgresql-10

\h:檢視sql命令的解釋,比如\h select。

\?:檢視psql命令列表。

\l:列出所有資料庫。

\c [database_name]:連線其他資料庫。

\d:列出當前資料庫的所有**。

\d [table_name]:列出某一張**的結構。

\du:列出所有使用者。

\conninfo:列出當前資料庫和連線的資訊。

centos7 安裝centos桌面

一 輸入命令 yum groupinstall gnome desktop graphical administration tools 二 設定系統啟動等級。systemctl get default 獲取當前系統執行形式,會顯示multi user.target 命令列終端 或者 graphic...

centos7安裝nginx(yum安裝)

感興趣的可以檢視用壓縮包安裝的過程 1 通過檢視當前linux核心以及版本號進行獲取nginx的rpm安裝源適配。uname a2 獲取nginx相關的rpm源 防止版本號不對應產生的各種問題 rpm uvh3 yum安裝nginx yum install nginx等待安裝完成。1 安裝完成後,n...

CentOS7安裝docker(yum安裝)

1.中文文件 2.檢視linux版本 cat etc redhat release3.是否聯網 這裡yun安裝,不聯網gg 4.解除安裝舊版本 sudo yum remove docker docker client docker client latest docker common docker...