zoukankan      html  css  js  c++  java
  • Mysql re-set password, mysql set encode utf8 mysql重置密码,mysql设置存储编码格式

    There is a link about how to re-set password.

    http://database.51cto.com/art/201010/229528.htm

    words in short,

    two lines

        mysql> UPDATE mysql.user SET password=PASSWORD('your_new_password') WHERE User='root';
        mysql> FLUSH PRIVILEGES;

    and about mysql encoding:

    here is a helpful link: http://www.linuxidc.com/Linux/2013-11/93011.htm

    ___

    首先这是我一开始的Ubuntu 下MySQL默认字符集(下图),在Java中输入中文到数据库中全是乱码问号,MySQL不识别,是因为MySQL默认的字符集是latin1(ISO_8859_1)不是utf8的字符集。

    修改方法:

    1.打开my.cnf文件进行修改(这里注意下,MySQL版本是5.5以上的,以下版本应该也通用,具体没有测试过,但在5.5以上的绝对可行)

    sudo gedit /etc/mysql/my.cnf

    2.在[mysqld]下添加如下代码(对于5.5以上版本,[mysqld]的default字符集设置已经是遗弃的参数,可以使用这几个,具体查看相应版本的手册)

    character-set-server=utf8

    collation-server=utf8_general_ci

    skip-character-set-client-handshake

    3.退出重启mysql服务

    sudo service mysql restart

    4.进入mysql查看字符集

    mysql> show variables like 'collation_%';

    mysql> show variables like 'character_set_%';

    ____Thanks for his sharing!

  • 相关阅读:
    C#定时执行任务
    C#判断数据库是否可连接(PING)
    Excel之导入数据
    JQuery之杂项方法$.grep()
    .Net EF 之代码生成策略
    平台与WeLink深度融合技术汇总
    Host is not allowed to connect to this MySQL
    excel中过长的数字怎么筛选重复项
    oracle 函数大全
    WinXP添加TLS1.1、TLS1.2支持
  • 原文地址:https://www.cnblogs.com/spaceship9/p/3853670.html
Copyright © 2011-2022 走看看