问题描述

ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

备注:新安装完数据库后,在 xshell 上登录 mysql 后,运行 SQL 语句报如上错误

解决方案一

# /etc/init.d/mysql stop // 关闭 mysql

# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

# mysql -u root mysql // 进入 mysql

mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root' and host='root' or host='localhost'; //把空的用户密码都修改成非空的密码就行了。

mysql> FLUSH PRIVILEGES;

mysql> quit # /etc/init.d/mysqld restart

# mysql -uroot -p

Enter password: <输入新设的密码newpassword>

解决方案二

mysql>  SET PASSWORD = PASSWORD('123456');  // 用这句话重新设置一次密码,就可以了

备注

方案一、二可以搭配使用,先用一,再用二

linux - mysql 异常:ERROR 1820 (HY000): You must SET PASSWORD before executing this statement的更多相关文章

  1. mysql安装过程中出现错误ERROR 1820 (HY000): You must SET PASSWORD before executing this statement解决

    mysql安装过程中出现错误ERROR 1820 (HY000): You must SET PASSWORD before executing this statement解决   最近新装好的my ...

  2. ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

    Linux rpm方式安装完MySQL之后 mysql>SET PASSWORD = PASSWORD('newpasswd');

  3. 【MySQL】ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing

    今天上午遇到了一个问题,新创建的mysql5.7的数据库,由于初始化有点问题,没有给root密码,用了免密码登录. 但是,修改了root密码之后,把配置中的免密登录的配置注释掉后,重启服务.服务正常启 ...

  4. 在linux安装mysql重启提示You must SET PASSWORD before executing this statement的解决方法

    利用安全模式成功登陆,然后修改密码,等于给MySql设置了密码.登陆进去后,想查询所有存在的数据库测试下.得到的结果确实: ERROR 1820 (HY000): You must SET PASSW ...

  5. mysql 5.7 ERROR 1820 (HY000):

    在首次登录Mysql 5.7 后,mysql数据库做出了很多的调整.执行大部分操作会提示这个错误 : ERROR 1820 (HY000): You must reset your password ...

  6. 第一次登录mysql,使用任何命令都报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

    问题: 使用临时密码登录成功后,使用任何myql命令,例如show databases;都提示下面的报错 ERROR 1820 (HY000): You must reset your passwor ...

  7. MySQL用户密码过期登陆报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

    今天接到主从复制失败告警,查看MySQL,发现MySQL能够登陆但是执行命令报错, ERROR 1820 (HY000): You must reset your password using ALT ...

  8. MySQL root账户密码设为“root”后执行命令提示ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

    修改root账户密码为“root”后,提示ERROR 1820 (HY000): You must reset your password using ALTER USER statement bef ...

  9. MySQL:ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

    解决方法: 修改密码:alter user 'root'@'localhost' identified by '123456'; mysql> use mysql; ERROR 1820 (HY ...

随机推荐

  1. leetcode-简单-栈-有效的括号

    给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效. 有效字符串需满足:  左括号必须用相同类型的右括号闭合. 左括号必须以正确的顺序闭合. 注意空字符串可被 ...

  2. 回炉重造之重读Windows核心编程-001-错误处理

    Windows处理错误靠的是API的返回值,类型不止一种种: VOID,函数不可能失败,Windows API的返回值很少是这个情况. BOOL,如果函数失败,则返回值是0,否则返回是非零值.不要测试 ...

  3. STT-MRAM存在的两个弊端

    随着自旋转移矩效应的发现以及材料和结构的优化,基于自旋转移矩效应的STT-MRAM器件应运而生.自从自旋转移矩效应被证实以来,一方面研究人员通过大量的努力尝试降低磁化反转的临界电流,增加热稳定性:另一 ...

  4. 经济学人精读笔记9:打出租out了,“飞的”时代要来了!

    经济学人精读笔记9:打出租out了,"飞的"时代要来了! 标签(空格分隔): 经济学人 Part 1 Flying taxis are taking off to whisk pe ...

  5. 【Java】实验代码整理(多线程、自定义异常、界面)

    1.界面+文件输入输出流 package finalExam; import java.awt.BorderLayout; import java.awt.Container; import java ...

  6. github上传大于100M的文件报错

    先小声逼逼一句:md gaowenxin95@LAPTOP-0MR6298S MINGW64 /d/Gaowenxin/China-Japan (master) $ git push origin m ...

  7. JavaSE学习笔记(13)---线程池、Lambda表达式

    JavaSE学习笔记(13)---线程池.Lambda表达式 1.等待唤醒机制 线程间通信 概念:多个线程在处理同一个资源,但是处理的动作(线程的任务)却不相同. 比如:线程A用来生成包子的,线程B用 ...

  8. Android中饼状图的绘制

    https://blog.csdn.net/cen_yuan/article/details/52204281

  9. PTA 符号配对 —— C++

    请编写程序检查C语言源程序中下列符号是否配对:/*与 */.(与 ).[与].{与}. 输入格式: 输入为一个C语言源程序.当读到某一行中只有一个句点.和一个回车的时候,标志着输入结束.程序中需要检查 ...

  10. hdu 1011 Starship Troopers(树上背包)

    Problem Description You, the leader of Starship Troopers, are sent to destroy a base of the bugs. Th ...