/***************************************************************************
* MySQL 字符集设置
* 说明:
* 数据库这块很多时候都会因为字符集不兼容导致数据通信异常,所以这边把
* MySQL的字符集设定为utf-8,这个比较通用。
*
* 2016-9-24 深圳 南山平山村 曾剑锋
**************************************************************************/ 一、参考文档:
. (原创)Linux下MySQL 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
Server version: 5.1.-log Source distribution Copyright (c) , , 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/ |
+--------------------------+----------------------------+
rows in set (0.00 sec) mysql> quit
Bye
[aplex@root ~]#

MySQL 字符集设置的更多相关文章

  1. Mysql字符集设置

    转 基本概念 • 字符(Character)是指人类语言中最小的表义符号.例如’A'.’B'等:• 给定一系列字符,对每个字符赋予一个数值,用数值来代表对应的字符,这一数值就是字符的编码(Encodi ...

  2. Mysql字符集设置 2 图

    基本概念 • 字符(Character)是指人类语言中最小的表义符号.例如'A'.'B'等: • 给定一系列字符,对每个字符赋予一个数值,用数值来代表对应的字符,这一数值就是字符的编码(Encodin ...

  3. mysql字符集设置注意事项

    mysql字符集设置必须是在具体的某一个数据库情况下才能进行设置 否则会报错.

  4. MySQL字符集设置及字符转换(latin1转utf8)

    MySQL字符集设置及字符转换(latin1转utf8) http://blog.chinaunix.net/uid-25266990-id-3344584.html  MySQL字符集设置及字符转换 ...

  5. [mysql]深入Mysql字符集设置[转载]

    http://www.laruence.com/2008/01/05/12.html 基本概念 • 字符(Character)是指人类语言中最小的表义符号.例如’A'.’B'等: • 给定一系列字符, ...

  6. mysql字符集设置utf-8

    mysql字符集设置utf-8 mysql修改环境的默认字符集为utf-8(当然你也可以设置成别的,国际点还是utf-8好) 如果不把mysql字符集统一下,后面还是有点麻烦的 首先得在服务里关掉my ...

  7. 深入Mysql字符集设置

    作者: Laruence(   ) 本文地址: http://www.laruence.com/2008/01/05/12.html 转载请注明出处 根据Chaos  Wang的PPT整理而成, 在此 ...

  8. docker mysql 文件挂载和MySQL字符集设置

    原文:docker mysql 文件挂载和MySQL字符集设置 docker run -p 3306:3306 --name mysql -v /usr/local/mysql/my.cnf:/etc ...

  9. mysql 字符集设置查看

    1.列出MYSQL支持的所有字符集: SHOW CHARACTER SET; 2.当前MYSQL服务器字符集设置 SHOW VARIABLES LIKE 'character_set_%'; 3.当前 ...

随机推荐

  1. Codeforces Round #313 (Div. 2) C. Gerald's Hexagon

    C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  2. 《Play for Java》学习笔记(五)Form

    本书第六章以一个实例介绍了Play Framework中Form的使用,如何绑定数据,如何进行验证 一.项目结构和action

  3. windows直接安装

  4. 解决ACTIVITI流程图设置字体不生效的问题

    在ACTIVITI 5.15的版本中,有一个设置流程图的字体配置. 配置如下: <bean id="processEngineConfiguration" class=&qu ...

  5. php中curl和fsockopen发送远程数据的应用

    最近要用到通过post上传文件,网上盛传的有curl的post提交和fsockopen,其中curl最简单,于是从最简单的说起. 这是简单的将一个变量post到另外一个页面 $url = ''; $d ...

  6. Https 协议

    前言 HTTPS(全称:Hypertext Transfer Protocol over Secure Socket Layer),是以安全为目标的HTTP通道,简单讲是HTTP的安全版.即HTTP下 ...

  7. javaMail创建邮件和发送邮件总结

    (注: 本文是参考http://www.cnblogs.com/xdp-gacl/p/4216311.html. 感谢博主的精彩的描述) 一, 前期的准备 1, 导入 mail.jar 二, 操作步骤 ...

  8. Windows XP PRO SP3 - Full ROP calc shellcode

    /*     Shellcode: Windows XP PRO SP3 - Full ROP calc shellcode     Author: b33f (http://www.fuzzysec ...

  9. ROS主题发布订阅控制真实的机器人下位机

    先模拟控制小乌龟 新建cmd_node.ccpp文件: #include"ros/ros.h" #include"geometry_msgs/Twist.h" ...

  10. wp8.1 Study1: 页面导航&页面间值传递

    摘要:wp8.1与wp8中很多API是不一样了,wp8.1把以前wp7.x时的api去掉了,更多与win8.1的API相似.比如以下的页面导航和页面之间的值传递 1.页面导航 利用Frame.Navi ...