⌘ Styx - Preparing a database
- ← back to main page
- « Preparing a database »
- Installation →
Setting Character Sets and Collations
In MariaDB, the real OpenSource successor of MySQL, the default character set is latin1, and the default collation is latin1_swedish_ci (which may differ by distros, eg. Differences in MariaDB in Debian). Both character sets and collations can be specified from the server right down to the column level, as well as for client-server connections. When changing a character set and not specifying a collation, the default collation for the new character set is always used.
Character sets and collations always cascade down, so a column without a specified collation will look for the table default, the table for the database, and the database for the server. It's therefore possible to have extremely fine-grained control over all the character sets and collations used in your data.
Serendipity Styx recommends and favors the UTF-8 mode, if nothing special is against that!
Example: Changing the default character set to UTF-8
To change the default character set from latin1 to UTF-8, the following settings should be specified in the my.cnf configuration file.
If only having access to a tool like PhpMyAdmin, click the home/startpage button on the top left side and see the "General Settings" Box to select a Charset/Collation of MySQL-Connection. Choose from utf8mb4 like announced next.
Best use MariaDB 10.x ++ or MySQL with a minimum version of at least 5.5.3, to have support for the following examples UTF8MB4 character set with full unicode support.
Added January 2020:
Nowadays better use utf8mb4_unicode_520_ci if available, since this relies to the newer Unicode Collation Algorithm (UCA).
[client] ... default-character-set=utf8mb4 ... [mysql] ... default-character-set=utf8mb4 ... [mysqld] ... collation-server = utf8mb4_unicode_520_ci init-connect='SET NAMES utf8mb4' character-set-server = utf8mb4 ...
Note that the default-character-set
option is a client option, not a server option.
Don't forget to restart the mysql service after saving.
You are now ready to install Serendipity.