首页 > 数据库 >Mysql 忘记密码后重置密码

Mysql 忘记密码后重置密码

时间:2023-08-21 11:57:13浏览次数:40  
标签:bin Mysql 重置 密码 mysql password root 输入

1.以管理员身份进入cmd命令行

输入 net stop mysql 停止mysql服务

2.进入mysql安装的bin目录

cd bin目录地址

 3.输入mysqld --console --skip-grant-tables --shared-memory

 此窗口不动在另开一个管理员权限cmd

4.进入mysql安装bin目录

5.输入mysql -uroot -p回车,不用输入密码,直接按回车跳过

 6.输入use mysql,进入数据库成功

 7.输入update user set password=password('123456') where user='root';

报错1066(42000)一个sql语句不规范的错误

  (1)后面尝试更改语句大小写

仍然抛出一样的错误

(2)更改语句为ALTER USER 'root'@'localhost' IDENTIFIED BY 'your password';

抛出错误1290(HY000)

 (3)先输入:flush privileges;再输入:set password for root@localhost=password('your password');

抛出错误 1066(42000

(4)先输入:flush privileges;再输入:ALTER USER 'root'@'localhost' IDENTIFIED BY 'your password';

成功修改

 

 

标签:bin,Mysql,重置,密码,mysql,password,root,输入
From: https://www.cnblogs.com/sugarwxx/p/17645645.html

相关文章

  • mysql 关键字 保留字
     MySQL::MySQL8.0ReferenceManual::9.3KeywordsandReservedWordshttps://dev.mysql.com/doc/refman/8.0/en/keywords.html9.3 KeywordsandReservedWordsKeywordsarewordsthathavesignificanceinSQL.Certainkeywords,suchas SELECT, DELET......
  • 设置root密码
    step-1打开终端(ctrl+alt+t),输入sudopasswdstep-2切换rootsuroot输入密码......
  • MySQL告警"[Warning] Connection attributes of length 571 were truncated"
     有时候会在mysql的错误日志中看到如下报错"[Warning]Connectionattributesoflength571weretruncated"。比如:2023-08-20T13:23:15.265489Z47753433[Warning]Connectionattributesoflength571weretruncated2023-08-20T13:23:15.274938Z47425089[Warning]C......
  • mysql 聚簇索引
    聚簇索引概念聚簇索引并不是一种单独的索引类型,而是一种数据存储方式。具体的细节依赖于其实现方式,但InnoDB的聚簇索引实际上在同一个结构中保存了B-Tree索引和数据行。聚簇索引并不是一种单独的索引类型,而是一种数据存储方式。具体的细节依赖于其实现方式,但InnoDB的聚簇......
  • k8s重置master节点
    1.删除所有node节点2.清空原先设置,所有节点执行kubeadmreset3.获取默认配置文件kubeadmconfigprintinit-defaults>kubeadm-config.yaml修改初始化配置文件1)advertiseAddress:192.168.2.34#本机IP2)imageRepository:registry.aliyuncs.com/google_container......
  • MYSQL: length() vs char_length()
     selectlength('€'),char_length('€')-->1,1 LENGTH() returnsthelengthofthe stringmeasuredinbytes.CHAR_LENGTH() returnsthelengthofthe stringmeasuredincharacters.ThisisespeciallyrelevantforUnicode,inwhich......
  • 【数据库】MySQL的一些基础知识
    ALTERTABLE表名DROP属性名删除数据表DROPTABLE数据库名.表名;用户管理创建用户CREATEUSER'username'@'host'IDENTIFIEDBy'password';username:欲创建用户的用户名password:用户密码host:主机地址,例如localhost、192.168.1.1用户删除DROPUSER'username'@......
  • rhel 6.5恢复MySQL 5.5.18从节点
    文档课题:rhel6.5恢复MySQL5.5.18从节点.系统:rhel6.564位数据库:MySQL5.5.18数据库安装包:mysql-5.5.18.tar.gzXtrabackup安装包:percona-xtrabackup-24-2.4.6-2.el6.x86_64.rpm系统架构:应用场景:主库binlog未被从库应用便被binlog保留策略自动删除,主从同步出现异常.以下模拟......
  • mysql 8 - linux 安装后 java 调用报错 SQLException: Temporary file write failure
    完整报错Cause:java.sql.SQLException:Temporaryfilewritefailure.;uncategorizedSQLException;SQLstate[HY000];errorcode[1878];Temporaryfilewritefailure.;nestedexceptionisjava.sql.SQLException:Temporaryfilewritefailure.解决不要作用在......
  • mysql 问答
    1、服务器架构的逻辑视图2、mysql执行一条语句的内部过程连接器:客户端连接过来权限验证、查询缓存:连接器权限验证通过后,查看是否有缓存,有就直接返回分析器:词法语法分析,分析是否有语法错误,有则返回优化器:看下哪个索引合适执行器:执行语句并返回结果3、mysql常用引擎innodb(5......