MySQL 字符集设置
2016-09-24 09:55
323 查看
/*************************************************************************** * MySQL 字符集设置 * 说明: * 数据库这块很多时候都会因为字符集不兼容导致数据通信异常,所以这边把 * MySQL的字符集设定为utf-8,这个比较通用。 * * 2016-9-24 深圳 南山平山村 曾剑锋 **************************************************************************/ 一、参考文档: 1. (原创)Linux下MySQL 5.5/5.6的修改字符集编码为UTF8(彻底解决中文乱码问题) http://www.ha97.com/5359.html 二、解决办法: cat /etc/my.cnf ...... [client] ...... default-character-set=utf8 ...... [mysql] ...... default-character-set=utf8 ...... [mysqld] ...... collation-server = utf8_unicode_ci init-connect='SET NAMES utf8' character-set-server = utf8 ...... 三、查看结果: [aplex@root ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.1.73-log Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> SHOW VARIABLES LIKE 'character%'; +--------------------------+----------------------------+ | 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 | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec) mysql> quit Bye [aplex@root ~]#
相关文章推荐
- 用命令行设置mysql字符集(转载)
- MySQL免安装版中文字符集设置
- Mysql 默认字符集设置方法(免安装版)
- MYSQL 设置字符集
- 设置Mysql字符集
- MYSQL 字符集的设置(命令行模式设置character_set*)
- MySQL字符集的设置
- mysql中的乱码总结之mysql5中四个设置字符集的系统变量
- mysql中的乱码总结之mysql5中四个设置字符集的系统变量
- mysql中的乱码总结之mysql5中四个设置字符集的系统变量
- [转]深入Mysql字符集设置
- 深入Mysql字符集设置
- [转]深入Mysql字符集设置
- MYSQL 字符集的设置(命令行模式设置character_set*)
- 深入Mysql字符集设置
- mysql 字符集的设置
- Mysql(免安装版)设置默认字符集
- Mysql字符集设置研究
- 深入Mysql字符集设置(1)
- Mysql 字符集 设置