O'Reilly logo

Managing & Using MySQL, 2nd Edition by Hugh E. Williams, Randy Yarger, George Reese, Tim King

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Simple Character Sets

Additional character sets may be configured into MySQL if they don’t require multi-byte character support or string collating routines. Adding a character set through configuration requires the following steps:

  1. Add the new character set to the file sql/share/charsets/Index [1]

  2. Create the configuration file for the new character set in sql/share/charsets.

  3. Edit your configure.in file to include the character set in the next compile.

  4. Recompile MySQL.

In this example, we will add a special character set called elvish. We first need to add it to the character set index file. The file looks like this:

$ cat sql/share/charsets/Index
# sql/share/charsets/Index
#
# This file lists all of the available character sets. Please keep this
# file sorted by character set number.


big5               1
czech              2
dec8               3
.
.
.
latin5            30
latin1_de         31

To add a new character set, simply add the character set to the end of the file with a unique index:

latin5            30
latin1_de         31
elvish            32

The next step is to create a configuration file in sql/share/charsets for your character set. You can base it on sql/share/charsets/latin1.conf.

$ cd sql/share/charsets
$ cp latin1.conf elvish.conf
$ vi elvish.conf

There are four array definitions in the configuration file. You need to edit each of these arrays to configure your character set. A # in the configuration file indicates a comment.

ctype

The ctype array[2] defines the features of each character in the character set. It consists of 257 hexadecimal words. Each ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required