PostgreSQL Notes


psql commands

\q                  # quits out of psql CLI interface
\password postgres  # assign password
\connect mydb       # connect to a database
\l                  # List databases
\dX                 # DIsplay information about X
\?                  # SHow description of commands

Command line

$ /usr/bin/postgresql-setup --initdb    # Initialize /var/lib/postgresl directory
$ createdb foo                          # Create a new database
$ dropdb foo                            # Drop the DB named foo
$ createuser                            # Creates a user
$ dropuser                              # Delete user

SQL statements

ALTER USER matty with PASSWORD 'dfsdfdsfdfdsfdsfds';
THIS INFORMATION IS PROVIDED UNDER A GPLV2 LICENSE
THE GPLV2 LICENSE CAN BE VIEWED HERE