Home
> postgresql > Up and running with PostgreSQL
Up and running with PostgreSQL
Up and running with PostgreSQL
1. Install
sudo apt-get install postgresql-9.3
2. Set a password to the postgres user
$ sudo -u postgres psql postgres psql (9.3.10) Type "help" for help. postgres=# \password postgres Enter new password: Enter it again: postgres=# \q
3. Create a new role
$ sudo -u postgres createuser -D -A -P mynewuser Enter password for new role: Enter it again:
4. Create a database using the new role
$ sudo -u postgres createdb -O mynewuser mynewdatabase
5. Connect to new database using new role
psql -h 127.0.0.1 -p 5432 mynewdatabase mynewuser Password for user mynewuser: psql (9.3.10) SSL connection (cipher: DHE-RSA-AES256-GCM-SHA384, bits: 256) Type "help" for help. mynewdatabase=> \q
6. Manual for createuser command
man createuser
Source:
https://help.ubuntu.com/community/PostgreSQL
http://www.postgresql.org/docs/current/static/app-createuser.html
http://www.postgresql.org/download/linux/ubuntu/
Categories: postgresql
Comments (0)
Trackbacks (1)
Leave a comment
Trackback
-
April 26, 2016 at 1:46 pmAllow remote hosts to connect to PostgreSQL database server on vagrant box | pseudo-scripter