• suse linux 下MYSQL 修改默认字符集


    首先在mysql下查看当前字符集

    mysql> show variables like "%char%";

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

    | Variable_name | Value |

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

    | character_set_client | latin1 |

    | character_set_connection | latin1 |

    | character_set_database | latin1 |

    | character_set_filesystem | binary |

    | character_set_results | latin1 |

    | character_set_server | latin1 |

    | character_set_system | latin1 |

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

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

    8 rows in set (0.00 sec)

    这个是使用的默认的latin1的字符集

    退出mysql在终端下输入

    vi /etc/my.cnf 在[ mysqld ] 下加入 default-character-set=utf8

    然后保存之后重启mysql服务

    service mysql restart

    再进入mysql里面

    mysql> show variables like "%char%";

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

    | Variable_name | Value |

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

    | character_set_client | latin1 |

    | character_set_connection | latin1 |

    | character_set_database | utf8 |

    | character_set_filesystem | binary |

    | character_set_results | latin1 |

    | character_set_server | utf8 |

    | character_set_system | utf8 |

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

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

    8 rows in set (0.00 sec)

    这个时候就已经修改好了。

    其他的还是latin1 可以使用 set names=utf8 就搞定

  • 相关阅读:
    hibernate--could not initialize proxy
    20160509-hibernate--继承映射
    CF1111C Creative Snap
    CF1097D Makoto and a Blackboard
    CF1091D New Year and the Permutation Concatenation
    CF1096D Easy Problem
    CF1076E Vasya and a Tree
    CF1081C Colorful Bricks
    CF1081E Missing Numbers
    CF1093D Beautiful Graph
  • 原文地址:https://www.cnblogs.com/dba_xiaoqi/p/1864355.html
Copyright © 2020-2023  润新知