PostgreSQLをインストールします。環境は,Ubuntu Serverの14.04です。
$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 DISTRIB_CODENAME=trusty DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"
apt-getでインストールします。
$ sudo apt-get install postgresql
バージョンを確認します。
$ psql --version psql (PostgreSQL) 9.3.5
状態を確認します。
$ /etc/init.d/postgresql status 9.3/main (port 5432): online
postgresユーザーになります。
$ sudo su postgres
テスト用のデータベースを作成します。
$ createdb testdb
普段のユーザーからデータベースを操作できるようにします。
$ psql testdb psql (9.3.5) Type "help" for help. testdb=# create role chitora with login; CREATE ROLE testdb=# \q
exitで普段のユーザーに戻ります。
$ exit
普段のユーザーからデータベースに接続してみます。
$ psql testdb psql (9.3.5) Type "help" for help. testdb=> \q
コメントを残す