插入中文是乱码,尝试了许多方法,比如我先把vim里设置为:set fileencoding=utf-8不起作用,后来想想也对,和vim没什么关系 然后就尝试c#代码,用Encoding.UTF8.GetString()方法,后来也不对。 我就郁闷了,忽然想起来莫不是mysql的设置问题??? 于是,sudo nano /etc/mysql/my.cnf 插入下面红色代码,default-character-set = utf8,成功,不乱码了~~~根本不用什么Encoding..... # This was formally known as [safe_mysqld]. Both versions are currently parsed. [mysqld_safe] socket =&nbs
插入中文是乱码,尝试了许多方法,比如我先把vim里设置为:set fileencoding=utf-8不起作用,后来想想也对,和vim没什么关系
然后就尝试c#代码,用Encoding.UTF8.GetString()方法,后来也不对。
我就郁闷了,忽然想起来莫不是mysql的设置问题???
于是,sudo nano /etc/mysql/my.cnf
插入下面红色代码,default-character-set = utf8,成功,不乱码了~~~根本不用什么Encoding.....
# 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 = mysql
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
标签: Linux 进行 MYSQL 编程 插入 中文 乱码 解决方案
声明:本文内容来源自网络,文字、图片等素材版权属于原作者,平台转载素材出于传递更多信息,文章内容仅供参考与学习,切勿作为商业目的使用。如果侵害了您的合法权益,请您及时与我们联系,我们会在第一时间进行处理!我们尊重版权,也致力于保护版权,站搜网感谢您的分享!