Linux (Ubuntu) uses journaling------settings for MySQL encoding (UTF-8)

Source: Internet
Author: User

mysq version: 5.7.21

Operating system: Linux (Ubuntu)  

The basic idea of the whole operation is as follows (including the solution idea of the problem, you can see the final command summary first if you want to solve the problem directly)  

Check MySQL code

Locate the MySQL configuration file

Modifying a configuration file

Restart MySQL service  

1. Check MySQL code

In the MySQL console input:show variables like ' character_set_% '; if not, then you need to modify the MySQL code.

2. Locate the MySQL configuration file

The configuration file for Ubuntu under MySQL is /etc/mysql/my.cnf

In fact, Linux can use the following command to find the configuration file

Find/-iname *.cnf-print

But we found that there were only two words.

!includedir/etc/mysql/conf.d/

!includedir/etc/mysql/mysql.conf.d/

that's not exactly what we're thinking. Yes, I guess it's 5.7. The configuration file is split and the configuration of different responsibilities is stored separately (not sure if you understand the right)  

So we put the files here in the two configuration folder open separately, we found

/etc/mysql/mysql.conf.d/mysqld.cnf The most configuration content, it seems that we need to find.

3. Modify the configuration file

Because the mysql5.7 version is a bit new, some of the configuration on the web is a bit less believable, but we can find the answer in the MySQL website's documentation.

Official documents:https://dev.mysql.com/doc/refman/5.7/en/

We can see a bunch of documents about character sets, with a configuring application character set and collaion, and I think that's what we need.

One of these words, I think we should write this configuration to our configuration file.

 

4 restart MySQL service

Service MySQL Restart  

re-enter MySQL view and you will find that your MySQL code is already configured  

Command Summary:

1 Viewing character sets: Show variables like ' character_set_% '

2 modifying configuration: sudo gedit/etc/mysql/mysql.conf.d/mysqld.cnf

3 add under [Mysqld]:

Character-set-server=utf8

Collation-server=utf8_general_ci

4 restart Mysql:service mysql restart

Linux (Ubuntu) uses journaling------settings for MySQL encoding (utf-8)

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.