Home > Backend Development > PHP Tutorial > sql programming Solution to insert Chinese garbled characters when MYSQL programming under Linux

sql programming Solution to insert Chinese garbled characters when MYSQL programming under Linux

WBOY
Release: 2016-07-29 08:36:34
Original
969 people have browsed it

Inserting Chinese characters is garbled. I tried many methods. For example, I first set vim to: set fileencoding=utf-8 but it didn't work. Then I thought about it and it has nothing to do with vim. Then I tried the c# code and used Encoding.UTF8. The .GetString() method was incorrect later.
I was depressed, and suddenly I thought there was something wrong with mysql settings? ? ?
So, sudo nano /etc/mysql/my.cnf
Insert the following red code, default-character-set = utf8, success, no more garbled characters~~~No need for encoding at all.....
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# *Basic Settings
#
user                                                                                                                                                          pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/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 above introduces the solution for inserting Chinese garbled characters when MYSQL programming under Linux in sql programming, including the content of sql programming. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template