small note on postgresql

|**|

postgresql postgres 006

createdb role

データーベースを 作成してみよう

$ createdb mm
bash: createdb: command not found
$ /usr/local/pgsql/bin/createdb mm
createdb: could not connect to database postgres: FATAL:  role "mm" does not exist

あきまへん まず 前半の おかたずけ

$ cp .bashrc .bashrc_mm_non_postgres
$ vi .bashrc
$ diff -s .bashrc .bashrc_mm_non_postgres 
180,186c180
< # 2005年12月21日 (水) 23:07:14 JST add below 6 lines
< PATH="$PATH":/usr/local/pgsql/bin
<  export POSTGRES_HOME=/usr/local/pgsql
<  export PGLIB=$POSTGRES_HOME/lib
<  export PGDATA=$POSTGRES_HOME/data
<  export MANPATH="$MANPATH":$POSTGRES_HOME/man
<  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":$PGLIB
---
> 
$ source .bashrc
$ createdb mm
createdb: could not connect to database postgres: FATAL:  role "mm" does not exist

後半に とりかかろう

createuser

ほなら postgres さんに なってと

# su - postgres
/dev/pts/0: Operation not permitted
$ pwd
/home/postgres
postgres@lx:~$ createuser
Enter name of role to add: mm
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
CREATE ROLE
postgres@lx:~$ exit
logout
# exit
logout
$ 

createdb database_name (mm01)

へたら 作成 してみよう

$ createdb mm01
CREATE DATABASE
$ psql -l
        List of databases
   Name    |  Owner   | Encoding 
-----------+----------+----------
 mm01      | mm       | EUC_JP
 postgres  | postgres | EUC_JP
 template0 | postgres | EUC_JP
 template1 | postgres | EUC_JP
 test      | postgres | EUC_JP
(5 rows)

にゃんたろう 拝!

2005年12月21日 (水) 23:52:09 JST 作成

|**|


small note on postgresql

Copyright © 2004.-2007. nyantarou All Rights Reserved.