AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / dba / 问题 / 282426
Accepted
K. Lok
K. Lok
Asked: 2021-01-02 01:22:12 +0800 CST2021-01-02 01:22:12 +0800 CST 2021-01-02 01:22:12 +0800 CST

无法重置 MySQL 密码

  • 772

我已经坚持了很长时间,我尝试按照此处的说明进行操作:https ://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html 。当我运行命令时,我将其作为输出:

2021-01-01T09:15:04.445377Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.22) starting as process 19920
2021-01-01T09:15:04.487135Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-01-01T09:15:04.901676Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-01-01T09:15:05.135403Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060
2021-01-01T09:15:05.240496Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-01-01T09:15:05.242979Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-01-01T09:15:05.325105Z 0 [System] [MY-010931] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: ready for connections. Version: '8.0.22'  socket: ''  port: 3306  MySQL Community Server - GPL.
2021-01-01T09:15:45.594^C297Z 0 [System] [MY
-013105] [Server] C:C:\Program Files\MySQL\MySQL Server 8.0\bin>\Pro
gram Files\MySQL\MC:\Program Files\MySQL\MySQL Server 8.0\bin>ySQL Server 8.0\bin\mysqld.exe: Normal shutdown.
2021-01-01T09:15:46.281364Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.22)  MySQL Community Server - GPL.
mysqld --init-file=C:\Users\user\text.txt --console
2021-01-01T09:15:51.297226Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.22) starting as process 21652
2021-01-01T09:15:51.320019Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-01-01T09:15:51.784233Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-01-01T09:15:52.015722Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060
2021-01-01T09:15:52.118175Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-01-01T09:15:52.126894Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-01-01T09:15:52.205977Z 0 [System] [MY-010931] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: ready for connections. Version: '8.0.22'  socket: ''  port: 3306  MySQL Community Server - GPL.

我不知道从这里做什么,因为我不认为它在教程中。任何解决此问题的帮助将不胜感激。谢谢

mysql windows
  • 1 1 个回答
  • 543 Views

1 个回答

  • Voted
  1. Best Answer
    Luuk
    2021-01-02T03:04:22+08:002021-01-02T03:04:22+08:00

    因为没有显示错误(但是这个 2021-01-01T09:15:45.594^C297 看起来不正常!),您应该按照过程中所示继续下一步。

    检查您的密码是否已更改。

    如果您的密码没有更改,请创建一个简单的初始化文件(即与步骤 3 中建议的相同),然后重试。

    如果您的密码已更改,请不要忘记删除init-file.

    编辑

    :我按照程序重置了我的“root”密码。

    此会话的所有输出都在这里,中间有一些注释:

    首先我们注意到我们不知道密码:

    C:\Program Files\MySQL\MySQL Server 8.0>mysql -u root -p
    Enter password: *******
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
    
    C:\Program Files\MySQL\MySQL Server 8.0>
    

    然后创建一个 mysql-init.txt 文件:

    C:\Program Files\MySQL\MySQL Server 8.0>type mysql-init.txt
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
    

    然后我们停止 MySQL 服务器。我的服务器名为 MySQL80,但您也可以从服务窗口停止它(更多详细信息请点击此处)

    C:\Program Files\MySQL\MySQL Server 8.0>net stop MySQL80
    The MySQL80 service is stopping.
    The MySQL80 service was stopped successfully.
    

    密码重置:

    • 注意路径名中的双 \\ 和完整路径周围的 "
    • 我对 MySQL 的默认设置位于此处“D:\MySQL Server 8.0\my.ini”,这几乎可以肯定在您所在的位置有所不同
        C:\Program Files\MySQL\MySQL Server 8.0>bin\mysqld.exe --defaults-file="D:\\MySQL Server 8.0\\my.ini" --init-file="C:\\Program Files\\MySQL\\MySQL Server 8.0\\mysql-init.txt" --console
        2021-01-01T18:51:09.333120Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
        2021-01-01T18:51:09.333840Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.22) starting as process 21888
        2021-01-01T18:51:09.341869Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
        2021-01-01T18:51:09.908748Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
        2021-01-01T18:51:10.083573Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060
        2021-01-01T18:51:10.143779Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
        2021-01-01T18:51:10.144078Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
        2021-01-01T18:51:10.192745Z 0 [System] [MY-010931] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: ready for connections. Version: '8.0.22'  socket: ''  port: 3306  MySQL Community Server - GPL.
    

    现在服务器启动并输出到控制台,停止服务器类型 CTRL+C:

    2021-01-01T18:51:20.697066Z 0 [System] [MY-013105] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Normal shutdown.
    ^C
    C:\Program Files\MySQL\MySQL Server 8.0>2021-01-01T18:51:21.447960Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.22)  MySQL Community Server - GPL.
    

    我们以正常方式(或通过服务)再次启动服务器:

    C:\Program Files\MySQL\MySQL Server 8.0>net start mysql80
    The MySQL80 service is starting.
    The MySQL80 service was started successfully.
    

    我们尝试登录:

    C:\Program Files\MySQL\MySQL Server 8.0>mysql -u root -pMyNewPass
    mysql: [Warning] Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 8
    Server version: 8.0.22 MySQL Community Server - GPL
    
    Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> alter user 'root'@'localhost' IDENTIFIED BY 'stackoverflow';
    

    使用最后一条命令,可以将密码更改为“stackoverflow”。我相信任何读过这篇文章的人都能想到一个更好的密码。

    • 1

相关问题

  • 是否有任何 MySQL 基准测试工具?[关闭]

  • 我在哪里可以找到mysql慢日志?

  • 如何优化大型数据库的 mysqldump?

  • 什么时候是使用 MariaDB 而不是 MySQL 的合适时机,为什么?

  • 组如何跟踪数据库架构更改?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve