Configuring MySQL - UTF8, partitioned tables, grant

MySQL needs configuration to become useful. The default character set should be set to UTF-8, users need permissions and support for partitioned tables should be activated.

UTF-8

In our globalised world, users have learnt to expect that they can input UTF-8 encoded text, which is great because now they can freely mix languages that are written in different alphabets, be it gujarati, greek or finnish.

નમસ્તે

Γειά σας

Hyvää päivää

There are a few default settings in MySQL that need to be set to make it UTF-8 clean.

Create a utf8.cnf in /etc/mysql/conf.d/ and put this in it:

[mysql]
default-character-set=utf8

[mysqld]
character-set-client-handshake = false #force encoding to uft8
character-set-server=utf8
collation-server=utf8_general_ci

Support for partitioned tables

Partitioned tables is the way to optimise response times when you work with Big Data. Partitioned tables requires that mysql can have many files opened at the same time. The default setting is too low.

Create a file open_files.cnf , (the file can be called anything as long as the name ends with ".cnf") in /etc/mysql/conf.d/ to increase the number of files that the server can have simultaneously open.

[mysqld]
open_files_limit = 200000

Make changes take effect

Restart the mysql server, e.g.

/etc/init.d/mysql restart

User permissions

Start mysql (the client) as root. Create a new user joe with password 8d1XsE4 by issuing

create user 'joe'@'localhost' identified by '8d1XsE4';

Let joe do things on databases, even drop them.

grant all on *.* to 'joe'@'localhost';

It is, of course, possible to give only some permissions to joe, but if you are joe, then that is not necessary. Need more info? Look here!

comments powered by Disqus


Back to the index

Blog roll

R-bloggers, Debian Weekly
Valid XHTML 1.0 Strict [Valid RSS] Valid CSS! Emacs Muse Last modified: oktober 12, 2017