PostgreSQL数据库创建、删除方法
2017-05-22 16:42
465 查看
1.在数据库服务器安装完成后,默认有三个数据库,可以通过下面两种方法查看。
[html]
view plain
copy
print?
postgres=# SELECT * FROM pg_database;
datname | datdba | encoding | datcollate | datctype | datistemplate | datallowconn | datconnlimit | datlastsysoid | datfrozenxid | dattablespace | datc
onfig | datacl
-----------+--------+----------+-------------+-------------+---------------+--------------+--------------+---------------+--------------+---------------+-----
------+-------------------------------------
template1 | 10 | 6 | zh_CN.UTF-8 | zh_CN.UTF-8 | t | t | -1 | 11563 | 648 | 1663 |
| {=c/postgres,postgres=CTc/postgres}
template0 | 10 | 6 | zh_CN.UTF-8 | zh_CN.UTF-8 | t | f | -1 | 11563 | 648 | 1663 |
| {=c/postgres,postgres=CTc/postgres}
postgres | 10 | 6 | zh_CN.UTF-8 | zh_CN.UTF-8 | f | t | -1 | 11563 | 648 | 1663 |
|
(3 rows)
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(3 rows)
postgres=#
这三个数据库均是由initdb生成的,其中template0 和template1 为数据库模板,创建时直接可以使用其克隆一个新数据库。
2. 创建方法,由什么用户创建,默认数据库owner就为此用户。
[html]
view plain
copy
print?
[postgres@kevin ~]$ psql postgres
psql (8.4.2)
Type "help" for help.
postgres=# CREATE DATABASE pg_databse_test_1;
CREATE DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
-------------------+----------+----------+-------------+-------------+-----------------------
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(4 rows)
postgres=#
另一种命令行创建方法:
[html]
view plain
copy
print?
[postgres@kevin ~]$ createdb pg_database_test_2;
[postgres@kevin ~]$ psql
psql (8.4.2)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
--------------------+----------+----------+-------------+-------------+-----------------------
pg_database_test_2 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(5 rows)
postgres=#
3.为其他数据库角色创建数据库。
[html]
view plain
copy
print?
postgres=# \du
List of roles
Role name | Attributes | Member of
----------------+-------------+-----------
pg_test_user_3 | Create DB | {}
pg_test_user_4 | Create role | {}
: Create DB
postgres | Superuser | {}
: Create role
: Create DB
postgres=# CREATE DATABASE pg_database_3 OWNER pg_test_user_4;
CREATE DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
--------------------+----------------+----------+-------------+-------------+-----------------------
pg_database_3 | pg_test_user_4 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_test_2 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(6 rows)
postgres=#
命令行方法:
[html]
view plain
copy
print?
[postgres@kevin ~]$ createdb -O pg_test_user_3 pg_database_4;
[postgres@kevin ~]$ psql
psql (8.4.2)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
--------------------+----------------+----------+-------------+-------------+-----------------------
pg_database_3 | pg_test_user_4 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_4 | pg_test_user_3 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_test_2 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(7 rows)
postgres=#
4. 使用模板数据库创建,此时,对模板的更改会引起所有基于它创建的数据库对象发生相同的变更。
[html]
view plain
copy
print?
postgres=# CREATE DATABASE pg_datebase_5 TEMPLATE template0; /*SQL方式*/
CREATE DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
--------------------+----------------+----------+-------------+-------------+-----------------------
pg_database_3 | pg_test_user_4 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_4 | pg_test_user_3 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_test_2 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_datebase_5 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(8 rows)
postgres=# \q
[postgres@kevin ~]$ createdb -T template0 pg_database_6 /*命令行方式*/
[postgres@kevin ~]$ psql
psql (8.4.2)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
--------------------+----------------+----------+-------------+-------------+-----------------------
pg_database_3 | pg_test_user_4 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_4 | pg_test_user_3 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_6 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_test_2 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_datebase_5 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(9 rows)
postgres=#
5. 删除数据库。
以SQL方法删除:
[html]
view plain
copy
print?
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
--------------------+----------------+----------+-------------+-------------+-----------------------
pg_database_3 | pg_test_user_4 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_4 | pg_test_user_3 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_6 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_7 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_test_2 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(9 rows)
postgres=# DROP DATABASE pg_database_3;
DROP DATABASE
postgres=# DROP DATABASE pg_database_4;
DROP DATABASE
postgres=# DROP DATABASE pg_database_6;
DROP DATABASE
postgres=# DROP DATABASE pg_database_7;
DROP DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
--------------------+----------+----------+-------------+-------------+-----------------------
pg_database_test_2 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(5 rows)
postgres=#
以命令行方式删除:
[html]
view plain
copy
print?
postgres=# \q
[postgres@kevin ~]$ dropdb pg_database_test_2
[postgres@kevin ~]$ dropdb pg_databse_test_1
[postgres@kevin ~]$ psql
psql (8.4.2)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(3 rows)
postgres=#
[html]
view plain
copy
print?
postgres=# SELECT * FROM pg_database;
datname | datdba | encoding | datcollate | datctype | datistemplate | datallowconn | datconnlimit | datlastsysoid | datfrozenxid | dattablespace | datc
onfig | datacl
-----------+--------+----------+-------------+-------------+---------------+--------------+--------------+---------------+--------------+---------------+-----
------+-------------------------------------
template1 | 10 | 6 | zh_CN.UTF-8 | zh_CN.UTF-8 | t | t | -1 | 11563 | 648 | 1663 |
| {=c/postgres,postgres=CTc/postgres}
template0 | 10 | 6 | zh_CN.UTF-8 | zh_CN.UTF-8 | t | f | -1 | 11563 | 648 | 1663 |
| {=c/postgres,postgres=CTc/postgres}
postgres | 10 | 6 | zh_CN.UTF-8 | zh_CN.UTF-8 | f | t | -1 | 11563 | 648 | 1663 |
|
(3 rows)
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(3 rows)
postgres=#
这三个数据库均是由initdb生成的,其中template0 和template1 为数据库模板,创建时直接可以使用其克隆一个新数据库。
2. 创建方法,由什么用户创建,默认数据库owner就为此用户。
[html]
view plain
copy
print?
[postgres@kevin ~]$ psql postgres
psql (8.4.2)
Type "help" for help.
postgres=# CREATE DATABASE pg_databse_test_1;
CREATE DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
-------------------+----------+----------+-------------+-------------+-----------------------
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(4 rows)
postgres=#
另一种命令行创建方法:
[html]
view plain
copy
print?
[postgres@kevin ~]$ createdb pg_database_test_2;
[postgres@kevin ~]$ psql
psql (8.4.2)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
--------------------+----------+----------+-------------+-------------+-----------------------
pg_database_test_2 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(5 rows)
postgres=#
3.为其他数据库角色创建数据库。
[html]
view plain
copy
print?
postgres=# \du
List of roles
Role name | Attributes | Member of
----------------+-------------+-----------
pg_test_user_3 | Create DB | {}
pg_test_user_4 | Create role | {}
: Create DB
postgres | Superuser | {}
: Create role
: Create DB
postgres=# CREATE DATABASE pg_database_3 OWNER pg_test_user_4;
CREATE DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
--------------------+----------------+----------+-------------+-------------+-----------------------
pg_database_3 | pg_test_user_4 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_test_2 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(6 rows)
postgres=#
命令行方法:
[html]
view plain
copy
print?
[postgres@kevin ~]$ createdb -O pg_test_user_3 pg_database_4;
[postgres@kevin ~]$ psql
psql (8.4.2)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
--------------------+----------------+----------+-------------+-------------+-----------------------
pg_database_3 | pg_test_user_4 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_4 | pg_test_user_3 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_test_2 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(7 rows)
postgres=#
4. 使用模板数据库创建,此时,对模板的更改会引起所有基于它创建的数据库对象发生相同的变更。
[html]
view plain
copy
print?
postgres=# CREATE DATABASE pg_datebase_5 TEMPLATE template0; /*SQL方式*/
CREATE DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
--------------------+----------------+----------+-------------+-------------+-----------------------
pg_database_3 | pg_test_user_4 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_4 | pg_test_user_3 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_test_2 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_datebase_5 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(8 rows)
postgres=# \q
[postgres@kevin ~]$ createdb -T template0 pg_database_6 /*命令行方式*/
[postgres@kevin ~]$ psql
psql (8.4.2)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
--------------------+----------------+----------+-------------+-------------+-----------------------
pg_database_3 | pg_test_user_4 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_4 | pg_test_user_3 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_6 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_test_2 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_datebase_5 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(9 rows)
postgres=#
5. 删除数据库。
以SQL方法删除:
[html]
view plain
copy
print?
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
--------------------+----------------+----------+-------------+-------------+-----------------------
pg_database_3 | pg_test_user_4 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_4 | pg_test_user_3 | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_6 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_7 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_database_test_2 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(9 rows)
postgres=# DROP DATABASE pg_database_3;
DROP DATABASE
postgres=# DROP DATABASE pg_database_4;
DROP DATABASE
postgres=# DROP DATABASE pg_database_6;
DROP DATABASE
postgres=# DROP DATABASE pg_database_7;
DROP DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
--------------------+----------+----------+-------------+-------------+-----------------------
pg_database_test_2 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
pg_databse_test_1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(5 rows)
postgres=#
以命令行方式删除:
[html]
view plain
copy
print?
postgres=# \q
[postgres@kevin ~]$ dropdb pg_database_test_2
[postgres@kevin ~]$ dropdb pg_databse_test_1
[postgres@kevin ~]$ psql
psql (8.4.2)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres
: postgres=CTc/postgres
(3 rows)
postgres=#
相关文章推荐
- PostgreSQL数据库创建、删除方法
- PostgreSQL数据库创建、删除方法
- PostgreSQL数据库创建、删除方法
- 创建 使用和删除PostgreSQL数据库的视图
- PostgreSQL用户创建删除及error while loading shared libraries解决方法
- Linux下创建Postgresql数据库的方法步骤
- PostgreSQL在非默认的路径下创建表空间及数据库后,删除数据库目录后,还需要删除pg_tblspc下的链接文件,否则尝试启动其他实例时会报错
- 常用数据库的自增字段创建方法汇总_DB2_Oracle_MySQL_PostgreSQL_SQL Server_Sybase
- ubuntu 14.04.5 第一次使用PostgreSQL如何创建、删除数据库
- PostgreSQL 关闭session链接,删除数据库方法
- 利用NPgsql 在PostgreSQL中创建和删除数据库
- postgresql数据库创建、修改、删除
- postgresql数据库三种删除重复数据的方法
- postgresql数据库创建、修改、删除
- PostgreSQL简介、安装、创建用户、启动关闭、创建删除数据库
- CF MVC3此操作要求连接到 'master' 数据库。无法创建与 'master' 数据库之间的连接,这是因为已打开原始数据库连接,并且已从连接字符串中删除凭据。请提供未打开的连接 解决方法
- PostgreSQL用户创建删除及error while loading shared libraries解决方法
- PostgreSQL数据库创建、删除、角色权限
- PostgreSQL简介、安装、用户管理、启动关闭、创建删除数据库
- PostgreSQL数据库创建/删除