我一直在尝试重置 MySQL 的 root 密码。
我已经习惯了两种方法来重置。但我没有得到它。
以下步骤已完成,但对我不起作用:
方法一:
1) 停止运行 MySQL 服务并创建一个 mysql-init.txt 文件。mysql-init.txt 包含:
USE mysql;
UPDATE mysql.user SET Password=PASSWORD('vikash') WHERE User = 'root';
FLUSH PRIVILEGES;
Run Code Online (Sandbox Code Playgroud)
2)我打开了命令提示符并输入了以下内容:
C:\Program Files\MySQL\MySQL Server 5.6\bin>mysqld.exe --defaults-file="my.ini" --init-file="C:\\Users\\user-name\\Desktop\\mysql-init.txt" --console
Run Code Online (Sandbox Code Playgroud)
我得到的错误如下:
无法打开所需的默认文件:C:\Program Files\MySQL\MySQL Server 5.6\b in\my.ini
默认处理中的致命错误。程序中止
方法2:
I simply opened the command prompt and typed as follows:
C:\Program Files\MySQL\MySQL Server 5.6\bin>mysqladmin -uroot -psample password
vikash
I got the error as:
Warning: Using a password on the command line interface can be insecure.
mysqladmin: connect …Run Code Online (Sandbox Code Playgroud) mysql ×1