Creating A User,Database and Assigning him Rights.
1)adduser test
2)su - postgres
3)psql template1
4)CREATE USER test WITH PASSWORD 'test';
5)create database testdb;
6)GRANT ALL PRIVILEGES ON DATABASE testdb to test;
7)\q
8)exit
9)su - test
$ psql testdb
Changing a password for a user
1)ALTER ROLE test WITH PASSWORD 'testing123';
Getting a list of databases
1)\l
Backing up Databases.
- Backup a certain database
pg_dump testdb > test.sql
- Backup All Databases
pg_dumpall > sql_all.sql
Restore a Database from a backup
1)drop database test
2)create database test
3)psql test < test.sql
Show tables in a database
1)\d table_name
Monday, April 5, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment