|
然后就嘗試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
php技術:Linux下進行MYSQL編程時插入中文亂碼的解決方案,轉載需保留來源!
鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。