mysql 中文乱码解决方法
操作方法
- 01
中文乱码基本都是字符编码格式设置不对引起,mysql一些选项默认为latin1 应该统一为UTF-8 。
- 02
先打开MySQL Command Line Client
- 03
查询相关字符集设置:show variables like 'character_set_%';结果如下 +--------------------------+-------------------------------------------------------------------+| 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
- 04
对相应的character_set_server 设置成 utf8: set character_set_server=utf8; 以上步骤只能暂时解决,安装数据库时要注意,在安装时选择 UTF编码!