linux下 mysql字符集的修改

  1. 1.查找/etc目录下是否有my.cnf文件;  
  2.   
  3.             #ls -l | grep my.cnf (在/etc下查找是否有my.cnf文件存在)  
  4.   
  5. 2.如果没有就要从/usr/share/mysql,拷贝一个到/etc 下,在/usr/share/mysql目录下有五个后缀为.cnf的文件,分别是 my-huge.cnf    my-innodb-heavy-4G.cnf    my-large.cnf   my-medium.cnf     my-small.cnf ;从中随便拷贝一个到/etc目录下并将其改为my.cnf文件
  6. 3.修改my.cnf文件
  7.     #vi  /etc/my.cnf 
  8.     [client]
  9.        default-character-set=utf8
  10.     [mysqld]
  11.        character-set-server=utf8
  12.           [mysql]
  13.        default-character-set=utf8
    1. mysql> show variables like 'character_set%' ;  
    2. +--------------------------+----------------------------+  
    3. | Variable_name            | Value                      |  
    4. +--------------------------+----------------------------+  
    5. | character_set_client     | utf8                       |  
    6. | character_set_connection | utf8                       |
    7. | character_set_database   | utf8                       |  
    8. | character_set_filesystem | binary                     |  
    9. | character_set_results    | utf8                       |  
    10. | character_set_server     | utf8                       |  
    11. | character_set_system     | utf8                       |  
    12. | character_sets_dir       | /usr/share/mysql/charsets/ |  
    13. +--------------------------+----------------------------+  
    14. mysql>\s
    15. Server characterset: utf8
      Db     characterset: utf8
      Client characterset: utf8
      Conn.  characterset: utf8


你可能感兴趣的:(linux下 mysql字符集的修改)