zoukankan      html  css  js  c++  java
  • 修改 Ubuntu 下 Mysql 编码

    mysql> show variables like 'character%';

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

    | Variable_name            | Value                      |

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

    | character_set_client     | utf8                       |

    | character_set_connection | utf8                       |

    | character_set_database   | latin1                     |

    | character_set_filesystem | binary                     |

    | character_set_results    | utf8                       |

    | character_set_server     | latin1                     |

    | character_set_system     | utf8                       |

    | character_sets_dir       | /usr/share/mysql/charsets/ |

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

     

    创建一个表查看是latin1的格式,修改/etc/my.cnf

    添加:

    [client]

    default-character-set=utf8

    [mysqld]

    default-character-set=utf8

    /etc/init.d/mysql restart  #启动不了了。

     

    后来查得原来从5版本之后变了,需要这样修改

    [client]

    default-character-set=utf8

    [mysqld]

    character-set-server=utf8

     

    /etc/init.d/mysql restart  #启动成功

    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/ |

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

     

    修改成功。

  • 相关阅读:
    ZOJ 1649: Rescue(BFS)
    UVA
    hdu2458:Kindergarten (最大独立集)
    hdu3829:Cat VS Dog (最大独立集)
    Java 泛型
    request.getParameter() 和request.getAttribute() 区别
    Solr版本安装部署指南
    java.sql.SQLException: Incorrect string value: 'xE6x88x91xE7x9Ax84...' for column 'groupName'
    Incorrect string value: 'xF0x9Fx98x84xF0x9F
    java里面byte数组和String字符串怎么转换
  • 原文地址:https://www.cnblogs.com/lzufe/p/4420225.html
Copyright © 2011-2022 走看看