Reference on commands commonly used in postgresql administration. Enjoy....
1. To start postgres
    # /etc/init.d/postgresql start
2. To stop postgres
    # /etc/init.d/postgresql stop
3. To start using postgres, change to user postgres
    $ su - postgres
4. To create new database
    $ createdb dbname
5. To delete database
    $ dropdb dbname
6. To access database
    $ psql dbname
7. To dump database (backup)
    $ pg_dump dbname > backup.out
8. Reload db from file
    $ psql -d dbname -f db.out
9. To dump all database to file
    $ pg_dumpall > dumpall.sql
10. Reload all from file
         $ psql -f dumpall.sql
11. List database
         $ psql -l
12. Clean all database
         $ vacuumdb --quiet --all
Commands inside psql (PostgreSQL interactive terminal)
1. Access psql
    # psql
2. Get help about commands
    # \h
3. Quit psql
    # \q
4. Import from file
       # \i input.sql
5. Show databases
       # \l
6. Show tables
       # \dt
7. Show users
       # \du
8. Connect to database
    # \c dbname
9. Change user password
       # \c template1
       # ALTER USER postgres with password 'new_password';
10. Clean database
      # VACUUM FULL;
11. Help on syntax command
      # \h SYNTAXNAME
Tuesday, October 23, 2007
Postgresql quickstart
Labels:
postgresql
Subscribe to:
Post Comments (Atom)
3 comments:
So, just curious, what else have you done with PG?
SO, just curious, what else have you done with PG?
i don't use pg that much. out of 10 applications, i only use pg on one of them. the rest i use mysql :-)
Post a Comment