How to insert Chinese garbled Characters During MYSQL programming in Linux
Source: Internet
Author: User
Inserting Chinese characters is garbled and many methods have been tried. For example, I first set "set fileencoding = UTF-8" in vim to not work. Later I thought It was correct. It has nothing to do with vim.
Then try the c # code and use the Encoding. UTF8.GetString () method, which is not correct later.
I was so depressed that I suddenly remembered that it was not a problem with mysql settings ???
Therefore, sudo nano/etc/mysql/my. cnf
Insert the following red code: default-character-set = utf8. The code is successfully inserted. No garbled characters are displayed ~~~ There is no need for Encoding .....
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[Mysqld_safe]
Socket =/var/run/mysqld. sock
Nice = 0
[Mysqld]
#
# * Basic Settings
#
User = mysql
Pid-file =/var/run/mysqld. pid
Socket =/var/run/mysqld. sock
Default-character-set = utf8
Port = 3306
Basedir =/usr
Datadir =/var/lib/mysql
Tmpdir =/tmp
Language =/usr/share/mysql/english
Skip-external-locking
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