How Can I Change the Character Encoding Format of a Database?

In GaussDB(DWS), the encoding format of a database cannot be changed. You need to create another database in the required format. For globalization purposes, set the encoding to UTF8 when creating a database.

Syntax

1
2
3
4
5
6
7
8
CREATE DATABASE database_name
    [ [ WITH ] { [ OWNER [=] user_name ] |
               [ TEMPLATE [=] template ] |
               [ ENCODING [=] encoding ] |
               [ LC_COLLATE [=] lc_collate ] |
               [ LC_CTYPE [=] lc_ctype ] |
               [ DBCOMPATIBILITY [=] compatibility_type ] |
               [ CONNECTION LIMIT [=] connlimit ]}[...] ];

Example

To create a UTF8 database music that can be modified later. (The encoding of the local environment must also be UTF8.)

CREATE DATABASE music ENCODING 'UTF8' template = template0;