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

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

     

    修改成功。

  • 相关阅读:
    js去java的变量
    android:layout_alignLeft=""和android:layout_toLeftOf=""
    c:foreach遍历list
    fragment的getActivity和activity的getapplication实现共享方法和变量
    java.lang.IllegalStateException: commit already called
    选择图片时调用手机拍摄和相册图片
    android:duplicateParentState属性
    java日期事件处理
    汉字字符串编码转换
    JAVA入门到精通-第5讲-类和对象
  • 原文地址:https://www.cnblogs.com/lzufe/p/4420225.html
Copyright © 2011-2022 走看看