MARIADB support for the Chinese character set

Source: Internet
Author: User

Today in the Django program, the MARIADB as a database, but mariadb (a branch of MySQL, fully compatible with MySQL, now led by the founder of MySQL) does not support the default Chinese character set, so the online search answers did not find the right solution, It is mariadb can not use, had to unload load mariadb, encounter some trouble, with ubuntu-14.04.

Uninstall has three steps: 1. Delete Mysql-server:sudo apt-get autoremove--purge mysql-server-5.5;2. sudo apt-get remove mysql-common;3. It is important to clean up residual data: sudo dpkg-l |grep ^rc|awk ' {print $} ' |sudo Xargs
Then reinstall MARIADB to sudo apt-get install Mariadb-server.

To solve the problem of Chinese character set

Open File: vim/etc/mysql/my.cnf

Add a row under [client] configuration:

Default-character-set=utf8

Add two lines under [Mysqld] (that is, the MySQL server configuration):

init_connect= ' SET NAMES UTF8 '

Character-set-server=utf8

and restart the MySQL service.

sudo service MySQL restart

This is a good way to use the Chinese language in Django applications, and it's an old problem to keep track of.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.