Postgresql

Change postgres user password

http://archives.postgresql.org/pgsql-novice/2007-02/msg00062.php

Assuming you still have TRUST authentication setup on the local server, open a psql session as the postgres user (you won't be asked for the password under TRUST authentication) to the database and execute the command:

sudo -s
sudo -u postgres psql 
ALTER USER Postgres WITH PASSWORD '<newpassword>';

Quit pqsl

http://my.safaribooksonline.com/book/databases/sql/0321334175/postgresql/ch01lev2sec25

Type \q and press Enter.

Tutorial

Manuals: http://www.postgresql.org/docs/manuals/

Dropping a role

http://articles.slicehost.com/2009/5/7/postgresql-creating-and-deleting-roles

What if we want to drop (delete, remove) a role? Easy:

#DROP ROLE demorole1;

http://www.postgresql.org/docs/9.1/static/database-roles.html

For convenience, the programs createuser and dropuser are provided as wrappers around these SQL commands that can be called from the shell command line:

createuser name
dropuser name
sudo -u postgres createuser -P django

Create database

To create the first database, which we will call "mydb", simply type:

sudo -u postgres createdb mydb

Drop a database

DROP DATABASE [ IF EXISTS ] name

Ubuntu

https://help.ubuntu.com/community/PostgreSQL

sudo apt-get install postgresql

pgAdmin III is a handy GUI for PostgreSQL, it is essential to beginners. To install it, type at the command line:

sudo apt-get install pgadmin3

To start off, we need to change the PostgreSQL postgres user password; we will not be able to access the server otherwise. As the “postgres” Linux user, we will execute the psql command.

sudo -u postgres psql postgres

Set a password for the "postgres" database role using the command:

\password postgres
Last edited by dudarev, 2012-05-17 08:27:59. Edit