免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
陳鋼的博客 CentOS7下初始化PostgreSQL

CentOS7下初始化PostgreSQL

2014 年 8 月 27 日

1、安裝epel;

1
rpm -ivh http://mirrors.hustunique.com/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm

或者

1
yum install epel-release

2、安裝postgresql;

1
yum install postgresql*

3、初始化數(shù)據(jù)庫(kù);

1
postgresql-setup initdb

4、啟動(dòng)postgresql并設(shè)置為開(kāi)機(jī)自啟動(dòng);

1
2
systemctl restart postgresql
systemctl enable postgresql

5、登進(jìn)數(shù)據(jù)庫(kù)看看狀態(tài);(可略)

1
2
3
4
5
su - postgres
psql
\du (查看角色)
\l (列出所有數(shù)據(jù)庫(kù))
\q (退出)

6、創(chuàng)建角色(postgresql中的用戶)和數(shù)據(jù)庫(kù)實(shí)例;

1
2
3
su - postgres
createuser dbuser
createdb -e -O dbuser dbname

7、給新用戶設(shè)定密碼

1
2
3
4
su - postgres
psql
\password dbuser (輸入兩次密碼)
vim /var/lib/pgsql/data/pg_hba.conf

在/var/lib/pgsql/data/pg_hba.conf中,將默認(rèn)驗(yàn)證方法

1
host    all             all             127.0.0.1/32            ident

改為密碼驗(yàn)證

1
host    all             all             127.0.0.1/32            md5

8、重啟數(shù)據(jù)庫(kù),讓新的驗(yàn)證方法生效

1
systemctl restart postgresql

9、新用戶登錄數(shù)據(jù)庫(kù);

1
psql -U dbuser -d dbname -h 127.0.0.1 (輸入之前的密碼)

10、玩耍;(以下操作皆在postgresql終端中)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
\dp (查看當(dāng)前庫(kù)中的表)
create table test1 (t1 int, t2 varchar(20));
\dp
\d test1 (查看表結(jié)構(gòu))
select * from test1 limit 10;
insert into test1 (t1,t2) values (11, 'ccccc'), (22, 'aaaa');
select * from test1 limit 10;
truncate table test1;
select * from test1 limit 10;
drop table test1;
select * from test1 limit 10;
\dp


本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
PostgreSQL基本用法
centos7 安裝postgresql
Netbox 開(kāi)源 IPAM 管理工具搭建詳細(xì)流程
Centos7安裝和配置Postgresql數(shù)據(jù)庫(kù)及Navicat連接
用Keepalived實(shí)現(xiàn)PostgreSQL高可用
關(guān)于postgresql
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服