数据库实例与数据库
Oracle中数据库实例与数据库是一对一的关系
PostgreSQL和MySQL中一个数据库实例对应多个数据库
数据库的相关操作
创建数据库
命令
CREATE DATABASE name
[ WITH ] [ OWNER [=] user_name ]
[ TEMPLATE [=] template ]
[ ENCODING [=] encoding ]
[ STRATEGY [=] strategy ] ]
[ LOCALE [=] locale ]
[ LC_COLLATE [=] lc_collate ]
[ LC_CTYPE [=] lc_ctype ]
[ ICU_LOCALE [=] icu_locale ]
[ ICU_RULES [=] icu_rules ]
[ LOCALE_PROVIDER [=] locale_provider ]
[ COLLATION_VERSION = collation_version ]
[ TABLESPACE [=] tablespace_name ]
[ ALLOW_CONNECTIONS [=] allowconn ]
[ CONNECTION LIMIT [=] connlimit ]
[ IS_TEMPLATE [=] istemplate ]
[ OID [=] oid ]
参数
参数 | 中文解释 |
OWNER | 给创建的数据库分配一个角色,这将是数据库的所有者。如果你省略了OWNER 选项,数据库的所有者是执行CREATE DATABASE 时的角色。 |
TEMPLATE | 默认情况下,PostgreSQL使用template 指定从中创建新数据库的模板数据库。如果未明确指定模板数据库,则将默认数据库作为模板数据库.默认tempate1 |
ENCODING | 确定新数据库中的字符集编码。默认语言与系统语言一致 |
LOCALE | 设置新数据库中的默认排序规则顺序和字符分类。排序规则影响应用于字符串的排序顺序,例如,在使用order BY的查询中,以及在文本列的索引中使用的顺序。字符分类会影响字符的分类,例如低位、高位和数字。还设置操作系统环境的相关方面LC_COLLATE和LC_CTYPE。默认设置与模板数据库的设置相同。 |
LC_COLLATE | 指定排序规则顺序 (LC_COLLATE ),新数据库将使用该排序规则。此参数影响的排序顺序字符串查询包含Order By 模板数据库。 |
LC_CTYPE | 指定新数据库将使用的字符分类。 它影响字符的分类,例如大写, 小写, 和数字. 它默认为模板数据库的LC_CTYPE |
TABLESPACE | 指定新数据库TABLESPACE的名称。默认值为模板数据库的表空间。默认表空间pg_default |
CONNECTION LIMIT | 指定到新数据库的最大并发连接。默认值为-1,即无限制。此参数在共享托管环境中非常有用,我们可以在其中配置特定数据库的最大并发连接。 |
ALLOW_CONNECTIONS | 参数allow_connections 的数据类型是布尔值。如果是false ,我们无法连接到数据库。 |
IS_TEMPLATE | 如果IS_TEMPLATE 是真的,任何角色的CREATE DATABASE 都可以克隆它。如果为false,则只有超级用户或数据库所有者可以克隆它。 |
ICU_Locale | 此数据库的 ICU 排序规则,如果在初始化时指定了 ICU,则此字段会显示对应的规则。ICU 是一种提供强大本地化支持的库,包括复杂的排序规则和文本处理功能。 |
ICU_RULES | 指定附加排序规则以自定义此数据库的默认排序规则的行为。 |
LOCALE_PROVIDER | 指定用于此数据库中默认排序规则的提供程序。可能的值是 icu(如果服务器是使用 ICU 支持构建的)或 libc。默认情况下,提供者与模板的提供者相同。 |
COLLATION_VERSION | 指定与数据库一起存储的排序规则版本字符串。通常,应省略此项,这将导致根据操作系统提供的数据库排序规则的实际版本来计算版本。该选项旨在由 pg_upgrade 用于从现有安装复制版本。 |
例子
1.创建ci_database_test01
postgres=# create database ci_database_test01;
CREATE DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
--------------------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------
ci_database_test01 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
circledba_test | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
postgres | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
template0 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
(5 rows)
postgres=#
创建的数据库ci_database_test01,所有者为postgres,字符集为UTF8,排序规则和语言符号及其分类为zh_CN.UTF-8
2.创建ci_database_test02,指定字符集为EUC_TW
postgres=# create database ci_database_test02 WITH ENCODING 'EUC_TW' LC_CTYPE="C" LC_COLLATE="C" TEMPLATE=template0;
CREATE DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
--------------------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------
ci_database_test01 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test02 | postgres | EUC_TW | libc | C | C | | |
circledba_test | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
postgres | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
template0 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
(6 rows)
postgres=#
衍生问题:
(1).为什么LC_CTYPE,LC_COLLATE设置为C?
答:设置为 C 是为了去除所有本地化的设置
(2).为什么一定要设置TEMPLATE=template0
答:使用 template1 模板库建库时不可指定新的 encoding 和 locale,而 template0 可以
(3).template1 和 template0 的区别?
答:1.template1 可以连接并创建对象,template0 不可以连接
postgres=# \c template1
You are now connected to database "template1" as user "postgres".
template1=# create table tmp_1( id int4);
CREATE TABLE
template1=# \c template0
FATAL: database "template0" is not currently accepting connections
Previous connection kept
template1 可以创建对像,被称为非干净数据库,而 template0被称为干净的数据库。
(4).根据需要创建符合自己编码方式的数据库
再/etc/profile 文件里加入:
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
再执行
CREATE DATABASE ci_database_test03
WITH
ENCODING = 'UTF8'
LC_COLLATE = 'en_US.utf8'
LC_CTYPE = 'en_US.utf8'
TABLESPACE = pg_default
template = template0
CONNECTION LIMIT = -1;
3.创建一个所有者(属主)为circledba用户的数据库ci_database_test04
postgres=# create user circledba with password '12345678ab';
CREATE ROLE
postgres=# create database ci_database_test03 WITH OWNER 'circledba';
CREATE DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
--------------------+-----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------
ci_database_test01 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test02 | postgres | EUC_TW | libc | C | C | | |
ci_database_test03 | circledba | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
circledba_test | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
postgres | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
template0 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
(7 rows)
postgres=#
4.创建表空间为pg_circle的数据库ci_database_test05
mkdir -p /data/16.1/tablespace/dba_circle
chown -R postgres:postgres /data/16.1/tablespace/dba_circle
chmod -R 700 /data/16.1/tablespace/dba_circle
postgres=# create tablespace dba_circle location '/data/16.1/tablespace/dba_circle';
CREATE TABLESPACE
postgres=# create database ci_database_test05 WITH TABLESPACE 'dba_circle';
CREATE DATABASE
postgres=# \l+
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges | Size | Tablespace | Description
--------------------+-----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------+---------+------------+--------------------------------------------
ci_database_test01 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | | 7561 kB | pg_default |
ci_database_test02 | postgres | EUC_TW | libc | C | C | | | | 7481 kB | pg_default |
ci_database_test03 | circledba | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | | 7561 kB | pg_default |
ci_database_test05 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | | 7561 kB | dba_circle |
circledba_test | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | | 7724 kB | pg_default |
postgres | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | | 7636 kB | pg_default | default administrative connection database
template0 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +| 7481 kB | pg_default | unmodifiable empty database
| | | | | | | | postgres=CTc/postgres | | |
template1 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +| 7716 kB | pg_default | default template for new databases
| | | | | | | | postgres=CTc/postgres | | |
(8 rows)
postgres=#
修改数据库
命令:
Command: ALTER DATABASE
Description: change a database
Syntax:
ALTER DATABASE name [ [ WITH ] option [ ... ] ]
where option can be:
ALLOW_CONNECTIONS allowconn
CONNECTION LIMIT connlimit
IS_TEMPLATE istemplate
ALTER DATABASE name RENAME TO new_name
ALTER DATABASE name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER DATABASE name SET TABLESPACE new_tablespace
ALTER DATABASE name REFRESH COLLATION VERSION
ALTER DATABASE name SET configuration_parameter { TO | = } { value | DEFAULT }
ALTER DATABASE name SET configuration_parameter FROM CURRENT
ALTER DATABASE name RESET configuration_parameter
ALTER DATABASE name RESET ALL
URL: https://www.postgresql.org/docs/16/sql-alterdatabase.html
例子
1.修改数据库名称
postgres=# \l
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
--------------------+-----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------
ci_database_test01 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test02 | postgres | EUC_TW | libc | C | C | | |
ci_database_test03 | circledba | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test05 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test06 | circledba | EUC_TW | libc | C | C | | |
circledba_test | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
postgres | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
template0 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
(9 rows)
postgres=# alter database ci_database_test06 rename to ci_database_test04;
ALTER DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
--------------------+-----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------
ci_database_test01 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test02 | postgres | EUC_TW | libc | C | C | | |
ci_database_test03 | circledba | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test04 | circledba | EUC_TW | libc | C | C | | |
ci_database_test05 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
circledba_test | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
postgres | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
template0 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
(9 rows)
postgres=#
2.修改数据库所属用户
postgres=# \l
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
--------------------+-----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------
ci_database_test01 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test02 | postgres | EUC_TW | libc | C | C | | |
ci_database_test03 | circledba | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test04 | circledba | EUC_TW | libc | C | C | | |
ci_database_test05 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
circledba_test | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
postgres | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
template0 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
(9 rows)
postgres=# alter database ci_database_test05 owner to circledba;
ALTER DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
--------------------+-----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------
ci_database_test01 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test02 | postgres | EUC_TW | libc | C | C | | |
ci_database_test03 | circledba | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test04 | circledba | EUC_TW | libc | C | C | | |
ci_database_test05 | circledba | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
circledba_test | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
postgres | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
template0 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
(9 rows)
postgres=#
删除数据库
命令
DROP DATABASE [ IF EXISTS ] name [ [ WITH ] ( option [, ...] ) ]
where option can be:
FORCE
URL: https://www.postgresql.org/docs/16/sql-dropdatabase.html
示例
1.删除ci_database_test05数据库
postgres=# DROP DATABASE ci_database_test05;
DROP DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
--------------------+-----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------
ci_database_test01 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test02 | postgres | EUC_TW | libc | C | C | | |
ci_database_test03 | circledba | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test04 | circledba | EUC_TW | libc | C | C | | |
circledba_test | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
postgres | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
template0 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
(8 rows)
postgres=#
2.强制删除ci_database_test04数据库
强制删除,意思是如果数据有进程在链接该数据普通删除是无法删掉的,需要加 FORCE命令
FORCE命令:如果当前用户无权终止其他连接,则此操作将会失败。所需权限与 pg_terminate_backend
相同
postgres=# DROP DATABASE ci_database_test04 WITH (FORCE);
DROP DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
--------------------+-----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------
ci_database_test01 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test02 | postgres | EUC_TW | libc | C | C | | |
ci_database_test03 | circledba | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
circledba_test | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
postgres | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
template0 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
(7 rows)
postgres=#
查看数据库
\l命令
postgres=# \l
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
--------------------+-----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------
ci_database_test01 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test02 | postgres | EUC_TW | libc | C | C | | |
ci_database_test03 | circledba | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
circledba_test | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
postgres | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
template0 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
(7 rows)
postgres=#
\l+ 命令
postgres=# \l+
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges | Size | Tablespace | Description
--------------------+-----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------+---------+------------+--------------------------------------------
ci_database_test01 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | | 7561 kB | pg_default |
ci_database_test02 | postgres | EUC_TW | libc | C | C | | | | 7481 kB | pg_default |
ci_database_test03 | circledba | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | | 7561 kB | pg_default |
circledba_test | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | | 7724 kB | pg_default |
postgres | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | | 7636 kB | pg_default | default administrative connection database
template0 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +| 7481 kB | pg_default | unmodifiable empty database
| | | | | | | | postgres=CTc/postgres | | |
template1 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +| 7716 kB | pg_default | default template for new databases
| | | | | | | | postgres=CTc/postgres | | |
(7 rows)
postgres=#
\list命令
postgres=# \list
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
--------------------+-----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------
ci_database_test01 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
ci_database_test02 | postgres | EUC_TW | libc | C | C | | |
ci_database_test03 | circledba | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
circledba_test | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
postgres | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | |
template0 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | zh_CN.UTF-8 | zh_CN.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
(7 rows)
postgres=#
select 命令
postgres=# SELECT datname FROM pg_database;
datname
--------------------
postgres
circledba_test
template1
template0
ci_database_test01
ci_database_test02
ci_database_test03
(7 rows)
postgres=#
PostgreSQL字符集参考表
Name | Description | Language | Server? | ICU? | Bytes/Char | Aliases |
---|---|---|---|---|---|---|
BIG5 |
Big Five | Traditional Chinese | No | No | 1-2 | WIN950 , Windows950 |
EUC_CN |
Extended UNIX Code-CN | Simplified Chinese | Yes | Yes | 1-3 | |
EUC_JP |
Extended UNIX Code-JP | Japanese | Yes | Yes | 1-3 | |
EUC_JIS_2004 |
Extended UNIX Code-JP, JIS X 0213 | Japanese | Yes | No | 1-3 | |
EUC_KR |
Extended UNIX Code-KR | Korean | Yes | Yes | 1-3 | |
EUC_TW |
Extended UNIX Code-TW | Traditional Chinese, Taiwanese | Yes | Yes | 1-3 | |
GB18030 |
National Standard | Chinese | No | No | 1-4 | |
GBK |
Extended National Standard | Simplified Chinese | No | No | 1-2 | WIN936 , Windows936 |
ISO_8859_5 |
ISO 8859-5, ECMA 113 | Latin/Cyrillic | Yes | Yes | 1 | |
ISO_8859_6 |
ISO 8859-6, ECMA 114 | Latin/Arabic | Yes | Yes | 1 | |
ISO_8859_7 |
ISO 8859-7, ECMA 118 | Latin/Greek | Yes | Yes | 1 | |
ISO_8859_8 |
ISO 8859-8, ECMA 121 | Latin/Hebrew | Yes | Yes | 1 | |
JOHAB |
JOHAB | Korean (Hangul) | No | No | 1-3 | |
KOI8R |
KOI8-R | Cyrillic (Russian) | Yes | Yes | 1 | KOI8 |
KOI8U |
KOI8-U | Cyrillic (Ukrainian) | Yes | Yes | 1 | |
LATIN1 |
ISO 8859-1, ECMA 94 | Western European | Yes | Yes | 1 | ISO88591 |
LATIN2 |
ISO 8859-2, ECMA 94 | Central European | Yes | Yes | 1 | ISO88592 |
LATIN3 |
ISO 8859-3, ECMA 94 | South European | Yes | Yes | 1 | ISO88593 |
LATIN4 |
ISO 8859-4, ECMA 94 | North European | Yes | Yes | 1 | ISO88594 |
LATIN5 |
ISO 8859-9, ECMA 128 | Turkish | Yes | Yes | 1 | ISO88599 |
LATIN6 |
ISO 8859-10, ECMA 144 | Nordic | Yes | Yes | 1 | ISO885910 |
LATIN7 |
ISO 8859-13 | Baltic | Yes | Yes | 1 | ISO885913 |
LATIN8 |
ISO 8859-14 | Celtic | Yes | Yes | 1 | ISO885914 |
LATIN9 |
ISO 8859-15 | LATIN1 with Euro and accents | Yes | Yes | 1 | ISO885915 |
LATIN10 |
ISO 8859-16, ASRO SR 14111 | Romanian | Yes | No | 1 | ISO885916 |
MULE_INTERNAL |
Mule internal code | Multilingual Emacs | Yes | No | 1-4 | |
SJIS |
Shift JIS | Japanese | No | No | 1-2 | Mskanji , ShiftJIS , WIN932 , Windows932 |
SHIFT_JIS_2004 |
Shift JIS, JIS X 0213 | Japanese | No | No | 1-2 | |
SQL_ASCII |
unspecified (see text) | any | Yes | No | 1 | |
UHC |
Unified Hangul Code | Korean | No | No | 1-2 | WIN949 , Windows949 |
UTF8 |
Unicode, 8-bit | all | Yes | Yes | 1-4 | Unicode |
WIN866 |
Windows CP866 | Cyrillic | Yes | Yes | 1 | ALT |
WIN874 |
Windows CP874 | Thai | Yes | No | 1 | |
WIN1250 |
Windows CP1250 | Central European | Yes | Yes | 1 | |
WIN1251 |
Windows CP1251 | Cyrillic | Yes | Yes | 1 | WIN |
WIN1252 |
Windows CP1252 | Western European | Yes | Yes | 1 | |
WIN1253 |
Windows CP1253 | Greek | Yes | Yes | 1 | |
WIN1254 |
Windows CP1254 | Turkish | Yes | Yes | 1 | |
WIN1255 |
Windows CP1255 | Hebrew | Yes | Yes | 1 | |
WIN1256 |
Windows CP1256 | Arabic | Yes | Yes | 1 | |
WIN1257 |
Windows CP1257 | Baltic | Yes | Yes | 1 | |
WIN1258 |
Windows CP1258 | Vietnamese | Yes | Yes | 1 | ABC , TCVN , TCVN5712 , VSCII |