PostgreSQL 資料庫的命令

2021-10-07 00:14:24 字數 1721 閱讀 8993

系統命令行視窗

查詢退出 \q

備註root@izuf624rjpfgj95cg9aw9fz:~#su postgres -

postgres@izuf624rjpfgj95cg9aw9fz:~$

postgres@izuf624rjpfgj95cg9aw9fz:~$psql

postgres=#

postgres=# \l

postgres=# \c newareas_db

psql -h localhost -p 5432 -u postgress testdb

select * from auth_user;

1.linux環境下

#su postgres

-bash-3.2$psql -u postgres

postgres=#alter user postgres with password 『new password』;

postgres=#\q

update info161 set student_name=『羅鵬青』 where info161.student_name=』 羅鵬青』;

drop database [ if exists ] name

drop table table_name ;

delete from table_name where id = 1;

– psql -u postgres -w -f db.sql

– 切換到linux使用者postgres,並執行psql - 位於資料庫提示符下

– su - postgres;psql;

– 建立使用者和資料庫

– create user cyw with password 『zgc_jmrh』;

– create database newareas_db owner cyw;

– 用新建立的使用者登入資料庫

– psql -u test_user -d test_db

create table newareas_class (

id serial not null ,

name varchar(255) null,

state int null default 1,

primary key (id)

);comment on column 「public」."newareas_class ".「name」 is 『名稱』;

insert into table_name (column1, column2, column3,…columnn)

values (value1, value2, value3,…valuen);

alter table 【表名】

add column 【欄位名】【資料型別】 【限制】,

add column 【欄位名】【資料型別】 【限制】;

alter table t_test add column t1 varchar(10) not null;表示不能為空

alter table t_test add column t1 varchar(10) default 『』;表示預設值為字串

alter table 「public」.「newareas_areasinfo」 alter column remarks

set data type int4 using remarks :: int4,

alter column remarks

set default 0;

PostgreSQL資料庫的注入

目錄 postgresql postgresql常用查詢命令 布林盲注 錯誤注入 堆疊注入 時間盲注 聯合查詢 postgresql是一種特性非常齊全的自由軟體的物件 關係型資料庫管理系統 ordbms 4.2版本為基礎的物件關係型資料庫管理系統。postgresql安裝後,預設的埠是 5432,預...

postgresql模板資料庫

template0和template1為postgresql資料庫的模板資料庫,新建的資料庫預設使用template1作為模板。template0和template1的區別在於template0無法修改,因此你可以修改template1資料庫以定製新建立的資料庫。template資料庫無法被刪除 d...

postgresql資料庫安裝

安裝並初始化 1 解壓資料庫並放到指定目錄 在opt目錄下 tar xvzf postgresql 10.1 1 linux x64 binaries.tar.gz 解壓出來之後目錄為pgsql 2 mv pgsql usr local pgsql 3 建立pgsql使用者並設定密碼 useradd...