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