mysql 修改character_set_server为utf-8的简单示例

前端之家收集整理的这篇文章主要介绍了mysql 修改character_set_server为utf-8的简单示例前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
感兴趣的小伙伴,下面一起跟随编程之家 jb51.cc的小编两巴掌来看看吧!

查看数据库编码如下:

MysqL> show variables like '%char%';

+--------------------------+----------------------------------+

| Variable_name            | Value                            |

+--------------------------+----------------------------------+

| character_set_client     | utf8                             |

| character_set_connection | utf8                             |

| character_set_database   | utf8                             |

| character_set_filesystem | binary                           |

| character_set_results    | utf8                             |

| character_set_server     | latin1                           |

| character_set_system     | utf8                             |

| character_sets_dir       | /usr/local/MysqL/share/charsets/ |

+--------------------------+----------------------------------+

8 rows in set

其中:

character_set_server     | latin1

编码为latin1,数据库出现中文乱码!

解决方法

修改编码为uft8;

set @@character_set_server='utf8';

猜你在找的MySQL相关文章