在powershell中重置密码报错
来源:2-5 MySQL的用户管理
慕码人7168405
2021-02-13 02:30:48
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\WINDOWS\system32> net stop mysql80
The MySQL80 service is not started.
More help is available by typing NET HELPMSG 3521.
PS C:\WINDOWS\system32> mysqld--defaults-file="C;\ProgramData\MySQL Server 8.0\my.ini"-init-file="E:/reset root password.txt"--console
mysqld--defaults-file=C;\ProgramData\MySQL Server 8.0\my.ini-init-file=E:/reset root password.txt--console : The
module 'mysqld--defaults-file=C;' could not be loaded. For more information, run 'Import-Module
mysqld--defaults-file=C;'.
At line:1 char:1
+ mysqld--defaults-file="C;\ProgramData\MySQL Server 8.0\my.ini"-init-f ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (mysqld--default...rd.txt--console:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoLoadModule
PS C:\WINDOWS\system32> mysqld--defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini"--init-file="E:/temp.txt"--console
mysqld--defaults-file=C:\ProgramData\MySQL\MySQL Server 8.0\my.ini--init-file=E:/temp.txt--console : The term 'mysqld--defaults-file=C:\ProgramData\MySQL\MySQL Server
8.0\my.ini--init-file=E:/temp.txt--console' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1
+ mysqld--defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini"- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (mysqld--default...mp.txt--console:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\WINDOWS\system32>
请老师帮忙看下问题,谢谢!
1回答
时间,
2021-02-19
同学,你好!
1、--defaults-file,--init-file和--console前边是有空格的,命令如下:
mysqld --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" --init-file="txt文件路径" --console(my.ini文件和txt文件都要改成同学自己目录下的文件路径)
2、以管理员方式打开PowerShell,在PowerShell中输入"Set-ExecutionPolicy"来修改,在冒号后输入Y按回车后再重新执行下命令
PS C:\WINDOWS\system32> set-ExecutionPolicy RemoteSigned 执行策略更改 执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies 帮助主题所述。是否要更改执行策略? [Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为“N”): Y
祝:学习愉快!
相似问题