postgresql-9.2 – 我的数据库在哪里发布了postgres?
发布时间:2020-12-13 18:09:52 所属栏目:百科 来源:网络整理
导读:postgres拒绝工作.我正在使用9.2和一个新手. 我创建了一个数据库.我列出了它不在那里?没有错误!它去了哪里?有没有创造过? postgres-# creatdb testpostgres-# list List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -
postgres拒绝工作.我正在使用9.2和一个新手.
我创建了一个数据库.我列出了它不在那里?没有错误!它去了哪里?有没有创造过? postgres-# creatdb test postgres-# list List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- postgres | postgres | UTF8 | en_PH.UTF-8 | en_PH.UTF-8 | template0 | postgres | UTF8 | en_PH.UTF-8 | en_PH.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_PH.UTF-8 | en_PH.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres (3 rows) postgres-# postgres@ubuntu:/home/ubuntu$psql -h 127.0.0.1 -U postgres -d test Password for user postgres: psql: FATAL: database "test" does not exist
你有两个错误:
> createdb是一个操作系统命令,它不是SQL命令.在psql中,您需要使用SQL语句,即:CREATE DATABASE.有关详细信息,请参见手册:http://www.postgresql.org/docs/current/static/sql-createdatabase.html postgres=# createdb test; ERROR: syntax error at or near "createdb" LINE 1: createdb test; ^ postgres=# create database test; CREATE DATABASE postgres=# list List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+---------------------+---------------------+----------------------- postgres | postgres | UTF8 | German_Germany.1252 | German_Germany.1252 | template0 | postgres | UTF8 | German_Germany.1252 | German_Germany.1252 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | German_Germany.1252 | German_Germany.1252 | postgres=CTc/postgres+ | | | | | =c/postgres test | postgres | UTF8 | German_Germany.1252 | German_Germany.1252 | 10 rows) postgres=# (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |