linux mysql 中文乱码的问题

搜索了不少资料,都不起作用,还是stackoverflow上的一位老兄的建议解决了我的问题,见:http://stackoverflow.com/questions/3513773/change-mysql-default-character-set-to-utf8-in-my-cnf

在上面网址对应的页面中,有图有真相;

我就摘抄几行:

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Then your configuration file (‘/etc/my.cnf‘ for example) should look like that:(但是不一定就是在/etc/my.cnf这个目录里,我的就是/etc/mysql/my.cnf文件)

  1. Remove that directive and you should be good.

  2. Then your configuration file (‘/etc/my.cnf‘ for example) should look like that:

    [mysqld]
    collation-server = utf8_unicode_ci
    init-connect=‘SET NAMES utf8‘
    character-set-server = utf8
  3. Restart MySQL.

  4. For making sure, your MySQL is UTF8, Run the following queries in your MySQL prompt:

    • First query:

       mysql> show variables like‘char%‘;
以下内容见http://stackoverflow.com/questions/3513773/change-mysql-default-character-set-to-utf8-in-my-cnf,粘贴复制也是很麻烦的


郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。