Sunday, March 13, 2011

Setting up PostgreSQL for Windows - (2) New User

1. Create a Test Database
Using SQL Shell ("psql"), login as user "postgres", the only user available initially.
Then create a test database.

Server [localhost]:
Database [postgres]:
Port [5433]:
Username [postgres]:
Password for user postgres:
psql (9.0.3)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.

postgres=# CREATE DATABASE testdb;
CREATE DATABASE
postgres=#


2. Add a New User
postgres=# CREATE ROLE socrateos WITH LOGIN CREATEDB;
CREATE ROLE
postgres=# ALTER USER socrateos WITH PASSWORD 'secret';
ALTER ROLE
postgres=#

3. Test Login as New User
Server [localhost]:
Database [postgres]: testdb
Port [5433]:
Username [postgres]: socrateos
Password for user socrateos:
psql (9.0.3)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.

testdb=>CREATE DATABASE mydb;
CREATE DATABASE
testdb=>

No comments:

Post a Comment