改密码失败,输入原密码也链接不上

来源:2-5 MySQL的用户管理

weixin_慕运维6121532

2022-10-23 09:55:16

相关截图:

PS C:\WINDOWS\system32> mysqld --defaults-file=“C:\ProgramData\MySQL\MySQL Server 8.0\my.ini” – init-file=“E:/navicat/temp.txt” --console
2022-10-23T01:52:36.239986Z 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.
2022-10-23T01:52:36.242303Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.31) starting as process 9372
2022-10-23T01:52:36.254085Z 0 [Warning] [MY-013907] [InnoDB] Deprecated configuration parameters innodb_log_file_size and/or innodb_log_files_in_group have been used to compute innodb_redo_log_capacity=100663296. Please use innodb_redo_log_capacity instead.
2022-10-23T01:52:36.256993Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-10-23T01:52:37.021823Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-10-23T01:52:37.473761Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-10-23T01:52:37.474129Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-10-23T01:52:37.498070Z 0 [ERROR] [MY-010147] [Server] Too many arguments (first extra is ‘init-file=E:/navicat/temp.txt’).
2022-10-23T01:52:37.499432Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-10-23T01:52:38.823464Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.

写回答

1回答

好帮手慕凡

2022-10-23

同学,你好!

同学检查一下所输入命令是否正确,可以根据以下步骤操作:

1、创建一个txt文件,定义修改密码的SQL语句:Alter user 'root'@'localhost' identified by '123456';。(123456是重置的密码)

2、打开命令行,停止mysql服务:net stop mysql80(mysql80是服务器名)

3、停止mysql服务后,输入以下命令:mysqld --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" --init-file="txt文件路径" --console(my.ini文件和txt文件都要改成同学自己目录下的文件路径)

4、执行以上命令,数据库就启动且修改了密码。

注意:如果退出mysqld命令后,数据库服务就关闭了,输入如下命令打开数据库服务:net start mysql80。这段内容老师在“步骤一 mysql的介绍 2-5 MySQL的用户管理”视频中会讲到,同学不太明白上面的步骤,可以观看视频。

祝学习愉快~ 

0

0 学习 · 4470 问题

查看课程