私は 'postgres' スーパーユーザーで新規の postgresql インストールで作業しています。次の方法でログインしました:
sudo -u postgres psql
postgres=# createdb database
postgres-# \list
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 |
template0 | postgres | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 | =c/postgres
: postgres=CTc/postgres
エラーはありませんが、テーブルは作成されていません。何かアイデアはありますか?
ベストアンサー1
createdb
は、以下のコマンドで実行できるコマンドラインユーティリティです。バッシュpsqlからではなく、psql次のような文を使用しますcreate database
。
create database [databasename];
注意: SQL文は常に次のように終了してください。;