psql

1.install psql 

sudo apt install postgresql postgresql-contrib;
sudo apt-get install postgresql-client;

2.login as the default user postgres

sudo -u postgres psql;

3.create user as superuser with password

create user sam superuser login password 'Sam0001!';

4.show all users;

\du;

 

5.login pgsql with sam

sudo psql -h localhost -p 5432 -Usam -dpostgres

 

6.grant all privileges to user in default user postgres

sudo -u postgres psql;
\du;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO sam;
\du;

 

posted @ 2023-11-12 20:17  FredGrit  阅读(28)  评论(0编辑  收藏  举报