mysql中文乱码,无法插入中文的解决办法总结
作者 佚名技术
来源 Linux系统
浏览
发布时间 2012-04-07
'''' Using delimiter: ; Server version: 5.1.11-beta-log Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: latin1 Db characterset:latin1 Client characterset:latin1 Conn. characterset: latin1 UNIX socket: /tmp/mysql.sock Uptime: 58 min 23 sec Threads: 2 Questions: 1067 Slow queries: 0 Opens: 0 Flush tables: 1 Open tables: 75 Queries per second avg: 0.305 -------------- 还可以用SHOW VARIABLES LIKE ''character_set_%'';指令察看内容如下: -------------------------- --------------------------------------------------------------------------- | Variable_name | Value | -------------------------- --------------------------------------------------------------------------- | character_set_client | latin1 | | character_set_connection | latin1 | | character_set_database |latin1| | character_set_filesystem | binary | | character_set_results | latin1 | | character_set_server |latin1| | character_set_system | utf8 | |character_sets_dir | /usr/local/src/mysql-5.1.11-beta-linux-i686-glibc23/share/mysql/charsets/ |
-------------------------- --------------------------------------------------------------------------- 8 rows in set (0.00 sec) 这就说明,除system是utf8之外的所有内容的字符集都为latin1,我们怎么样才能使用utf字符集呢? 有人说可以在my.cnf文件的[mysqld]段中加入default-character-set=utf8这一项就可以解决,但经过我的实验,这一条 完全没有必要,以下是增加了这一项后得显示结果. mysql> status; -------------- mysql Ver 14.7 Distrib 4.1.9, for pc-linux-gnu (i686) Connection id: 62 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '''' Using delimiter: ; Server version: 5.1.11-beta-log Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: latin1 Db characterset: utf8 Client characterset: utf8 Conn. characterset: latin1 UNIX socket: /tmp/mysql.sock Uptime: 1 hour 6 min 18 sec Threads: 2 Questions: 1071 Slow queries: 0 Opens: 0 Flush tables: 1 Open tables: 75 Queries per second avg: 0.269 -------------- mysql> SHOW VARIABLES LIKE ''character_set_%''; -------------------------- --------------------------------------------------------- |
|
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于mysql中文乱码,无法插入中文的解决办法总结的所有评论