วันจันทร์ที่ 17 กันยายน พ.ศ. 2555

How add postgres user

Step 1 : Add Unix/Linux User
Step 2 : Using Superuser command
             #su -l pgsql
Step 3 : Connect to Database Server
             #psql template1
             or
             #psql -d template1 -U pgsql

             Output
             bla bla bla
             template1=#
Step 4 : Add user
             template1=#CREATE USER xman WITH PASSWORD 'mypass';
Step 5 : Add Database
             template1=#CREATE DATABASE test1;
             template1=#GRANT ALL PRIVILEGES ON DATABASE test1 to xman;
             *** If you want to alter user to superuser use the following command
             ALTER USER myuser WITH SUPERUSER;
             template1=#\q
Step 6 : Test Login
             $su -l xman
             $psql -d test1 -U xman
         
             Output
             bla bla bla
             test1=>

Solution from http://www.cyberciti.biz/faq/howto-add-postgresql-user-account/

ไม่มีความคิดเห็น:

แสดงความคิดเห็น