问题描述

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. maven导入sqlserver驱动jar包依赖包到本地仓库

    maven导入sqlserver驱动jar包依赖包到本地仓库 maven项目使用sqlserver的依赖,先下载一个sqlserver的驱动,网址:https://www.microsoft.com/ ...

  2. Apache Solr Velocity模板注入rce+获取交互式shell

    前言: 官方的poc.exp payload只能获取很低的命令执行权限,甚至有些符号.命令还被过滤了,例如管道符被过滤.并且不能写入.下载文件,不能使用管道符重定向文件.那么我们只能通过获取到交互式s ...

  3. Tunnel Warfare HDU - 1540

    #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> us ...

  4. 论文阅读笔记(十五)【CVPR2016】:Top-push Video-based Person Re-identification

    Approach 特征由两部分组成:space-time特征和外貌特征.space-time特征由HOG3D[传送门]提取,其包含了空间梯度和时间动态信息:外貌特征采用颜色直方图[传送门]和LBP[传 ...

  5. QFile文件读写

    参考代码 .h文件 #ifndef MYWIDGET_H #define MYWIDGET_H #include <QWidget> #include <QFile> #inc ...

  6. 获取现有Table中某些字段

    //dtH System.Data.DataTable dttemp = new System.Data.DataTable(); DataView tempDv = dtH.DefaultView; ...

  7. FastDFS 单机部署指南

    简介 FastDFS是一个开源的分布式文件系统,官方介绍有详细的介绍,不多赘述.本文主要是FastDFS的搭建及采坑指南. Step By Step Guide 系统 阿里云ECS Ubuntu 16 ...

  8. Chocolaty

    原文是用markdown格式写的,稍微改了下发了博客,格式可能会很奇怪.. Chocolaty官网 Chocolaty是一款Windows平台的包管理工具,类似于centos的yum或ubuntu的a ...

  9. 自适应阈值化操作:adaptiveThreshold()函数

    在图像阈值化操作中,更关注的是从二值化图像中,分离目标区域和背景区域,但是仅仅通过设定固定阈值很难达到理想的分割效果.而自适应阈值,则是根据像素的邻域块的像素值分布来确定该像素位置上的二值化阈值.这样 ...

  10. Oracle中表与包体用户没有操作权限问题

    一.表1.在stg用户下查看table_name 表是否存在select * from table_name 2 在表所在用户执行(授权)grant select,update on table_na ...