加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

PostgreSQL不创建具有“createdb”作为超级用户的数据库,但不输

发布时间:2020-12-13 16:43:05 所属栏目:百科 来源:网络整理
导读:我正在使用一个新的postgresql安装,与’postgres’超级用户。登录: sudo -u postgres psqlpostgres=# createdb databasepostgres-# list List of databases Name | Owner | Encoding | Collation | Ctype | Access privileges -----------+----------+---
我正在使用一个新的postgresql安装,与’postgres’超级用户。登录:
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

没有错误,但是没有创建表。有任何想法吗?

createdb是一个命令行实用程序,您可以从bash运行而不是从psql运行。
要从psql创建数据库,请使用create database语句,如下所示:
create database [databasename];

注意:一定要始终结束你的SQL语句;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读