Help Center/ GaussDB(for MySQL)/ Troubleshooting/ Basic Issues/ Character Set and Collation Settings
Updated on 2023-10-19 GMT+08:00

Character Set and Collation Settings

Related Variables

By default, character_set_server is set to utf8 and collation_server to utf8_general_ci for your DB instance. You can change the values on the console.

Configuring Character Sets and Collations for Databases, Tables, and Fields

  • If the character set and collation are not explicitly specified for a database during database creation, the values of character_set_server and collation_server are used for the database. If the character set and collation are explicitly specified, the specified character set and collation are used for the database.
  • If the character set and collation are not explicitly specified for a table during table creation, the character set and collation of the database hosting the table are used for the table. If the character set and collation are explicitly specified, the specified character set and collation are used for the table.
  • If the character set and collation are not explicitly specified for a field during table creation, the character set and collation of the table hosting the field are used for the field. If the character set and collation are explicitly specified, the specified character set and collation are used for the field.

Example 1: Create a database and table without explicitly specifying the character set and collation.

Example 2: Create a database with the character set and collation explicitly specified.

Example 3: Create a table with the character set and collation explicitly specified for the table.

Example 4: Create a table with the character set and collation explicitly specified for a field.