折腾MySQL,遇到的问题

来源:互联网 发布:淘宝肉妈护肤品扒皮 编辑:程序博客网 时间:2024/06/07 00:52

   MySQL 5.7.18  

   Centos  6.9



  执行    mysqld_safe --user=mysql --skip-grant-tables --skip-networking

   进入MySQL     mysql  -u root

   重置密码      UPDATE user SET authentication_string=PASSWORD"('your password’)" where USER='root';

    再次进入 MySql  执行  show databases;  报出错误 :ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

    

step 1: SET PASSWORD = PASSWORD('your new password');

step 2: ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;

step 3: flush privileges;

参考:http://www.cnblogs.com/debmzhang/p/5013540.html