MySql乱码解决(五)

发表于:2013-06-03来源:Csdn作者:xyz_lmn点击数: 标签:MySQL
一.安装数据库时选择编码方式为 utf-8 装好后, show variables like'character_set_%';查看 如下: 1 mysql> SHOW VARIABLES LIKE 'character_set_%';

  一.安装数据库时选择编码方式为 utf-8 装好后,

  show variables like'character_set_%';查看 如下:

  1 mysql> SHOW VARIABLES LIKE 'character_set_%';

  2 +--------------------------+-----------------------------------------+

  3 | Variable_name Value |

  4 +--------------------------+-----------------------------------------+

  5 | character_set_client latin1 |

  6 character_set_connection latin1 |

  7 | character_set_database latin1 |

  8 | character_set_filesystem binary |

  9 | character_set_results latin1 |

  10 | character_set_server latin1 |

  11 | character_set_system utf8 |

  12 | character_sets_dir | E:/usr/MySQL Server /share/charsets/ |

  13 +--------------------------+-----------------------------------------+

  14 8 rows in set (0.00 sec)

  只有character_set_system 为utf8.

  二。修改my.ini里的[my sql]

  default-character-set=latin1

  [my sqld]

  ……

  ……

  default-character-set=latin1

  为utf8后,在查看编码:又有两个的编码方式变成了 utf8

  character_set_database和character_set_server的编码方式变成了utf8

  三。执行命令 set names 'utf8'

  结果,所有的编码方式都一致了。

原文转自:http://blog.csdn.net/xyz_lmn/article/details/4209776