Configuring UTF8 Character Set for MySQL
To create a MySQL database which uses the utf8 character set:
Create a new database:
CREATE DATABASE <database name> DEFAULT CHARACTER SET utf8Open
<TeamCity data directory> /config/database.properties
, and add thecharacterEncoding
property:connectionProperties.characterEncoding=UTF-8
To change the character set of an existing MySQL database to utf8:
Shut the TeamCity server down.
Dump the database data to the file
dump_data.sql
:mysqldump -t -u<user> -p<pass> <database>>dump_data.sql;Dump the database schema to the file
dump_schema.sql
:mysqldump -d -u<user> -p<pass> <database>>dump_schema.sqlEdit
dump_schema.sql
. RemoveDEFAULT CHARSET=<some charset>
from the table and column definitions.Create a new database with uft8 as the default character set:
CREATE DATABASE <new database name> DEFAULT CHARACTER SET utf8;Import
dump_schema.sql
into the new database:mysql -u<user> -p<pass> <new database name> <dump_schema.sqlImport
dump_data.sql
into the new database:mysql -u<user> -p<pass> <new database name> <dump_data.sqlModify
<TeamCity data directory> /config/database.properties
file as follows:change
connectionUrl
property to:jdbc:mysql://<host>/<new database name>add
characterEncoding
property:connectionProperties.characterEncoding=UTF-8