2026-03-12 21:01:38
This commit is contained in:
32
postgresql/usefull_commands_01.txt
Normal file
32
postgresql/usefull_commands_01.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
# create user
|
||||
create user wombat password 'secret';
|
||||
|
||||
# create database
|
||||
create database dbaquaris;
|
||||
|
||||
# grant ALL privileges on a database to a user
|
||||
grant all on database dbaquaris to wombat;
|
||||
|
||||
|
||||
\c dbaquaris
|
||||
grant all on schema public to wombat;
|
||||
|
||||
# connect
|
||||
psql -h aquaris -U wombat -d dbaquaris;
|
||||
|
||||
# create schema
|
||||
create schema bank;
|
||||
|
||||
# WAL archive status
|
||||
select * from pg_stat_archiver;
|
||||
|
||||
select * from pg_ls_dir ('pg_wal/archive_status') ORDER BY 1;
|
||||
|
||||
# switch current WAL
|
||||
select pg_switch_wal();
|
||||
|
||||
# show data directory
|
||||
show data_directory;
|
||||
|
||||
# list databases with details
|
||||
\l+
|
||||
Reference in New Issue
Block a user