Modify the default encoding of mysql under ubuntu16.04.1, and Ubuntu 16.04.1mysql
Configure Mysql character encoding in Ubuntu. After Mysql is installed, the default character encoding is latin1. The input is Chinese, but the output is a bunch of garbled characters. Now, you need to set the default character encoding of Mysql to support Chinese characters, such as GBK, GB23112, and so on.
Seriously speaking, the two mentally retarded mountains that I face from the Development of datiao programmers are coding and version problems. I feel uncomfortable and have no technical troubles.
Let's just talk about how to enable our teclon Go ~
First, find the mysql configuration file.
I will map it for my convenience. Sorry.
First, go to the directory where mysql stores configuration files.
Other installation methods can be found in your custom directory.
My. cnf is the configuration file.
Open my. cnf in a text file
This is what gedit looks like. After all, there is a Desktop linux, and there is a gedit that requires vi or vim.
If you do not have a graphic interface, please use the vi artifacts honestly.
View the mysql configuration file
Find the file referenced by this header file. The path is absolute.
Go to the mysql. conf. d file.
There are two configuration files in it. We need to modify mysqld. cnf. This is the basic configuration file of the mysql server, and it seems to be a security configuration file. No matter what it is, it has nothing to do with this purpose.
Use vi or gedit to view mysqld. cnf
Basic operations on vi
← H → L ↑ K ↓ j I insert (enter edit mode) esc exit edit mode: wq! Force exit and save (the command mode is the mode after esc). This is enough.
For more information about how to use labels for vi
This is not enough. We need to set the default encoding of the client.
Now, go to the mysql client configuration file directory.
Ls to see what is there
Mysql. cnf and mysqldump. cnf
We use vi or gedit to view mysql. cnf
In this way, the data encoding added by the client is utf8 by default.
Press esc key: wq! Save
The last sentence is to restart the mysql service.
Log on to mysql and use \ s to check whether the modification is successful.
This issue is here. If you have any mistakes, please note that