MySQL changes the default encoding under ubuntu16.04.1

Source: Internet
Author: User

Configure the character encoding for Mysql under Ubuntu. After installing Mysql, the system default character encoding is latin1, the input is Chinese, but the output is a bunch of garbled. Now all we have to do is set MySQL's default character encoding to support Chinese encoding, such as GBK, GB23112, and so on.

Seriously, I am a big celestial programmer to develop the two obstacles to the mountain is the coding problem and version of the problem, how to feel uncomfortable, no technical point of trouble.

It's not much nonsense to start our special Lyon go~.

First we find the MySQL configuration file

This is for my convenience, I have the stickers, please forgive me.

First enter the directory where MySQL stores the configuration files

Other installation methods go to your custom directories and find them.

Inside of the content where my.cnf is the config file

Open my.cnf with a text file

This is gedit open appearance, after all, there is a desktop Linux, there is gedit to use VI or VIM

Students without graphical interface please use the VI artifact honestly

View MySQL configuration file

Then find the file referenced by this header file, the path is the absolute path can be found

Go to MYSQL.CONF.D file

There are two configuration files in it. We need to modify the mysqld.cnf this is the MySQL server base configuration file another seems to be a security profile, regardless, it has nothing to do with this purpose.

View mysqld.cnf with VI or gedit

Basic Operations on VI

←h→l↑k↓j I insert (enter edit mode) ESC exits edit mode: wq! Force exit Save (Command mode is the mode after ESC) these are enough.

More about the use of VI http://www.cnblogs.com/liu_xf/archive/2011/05/16/2047554.html Park is a lot of casually caught

It's not enough, we're going to set the default encoding for the client

We now enter the MySQL client configuration file directory

LS, look what's in there.

MYSQL.CNF and MYSQLDUMP.CNF

We use VI or gedit to view mysql.cnf

This allows the client to add data encoding by default to UTF8

Press the ESC key: wq! Save

Last sentence restart MySQL service

Enter MySQL with \s to see if the modification was successful

This issue is here, and it's wrong to welcome the point

MySQL changes the default encoding under ubuntu16.04.1

Related Article

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.