MySQL 使用错误的mysql配置重置root密码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4124447/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
reset root password with wrong mysql config
提问by matheszabi
I have installed xampp, I did the security settings, but after a time I have forgot the root password. I have google it, how to reset, the problem seems he can't create lower-lower-test file, because he try to accesss a Unix path on my windows PC :), lol. xamp config.
我已经安装了 xampp,我做了安全设置,但过了一段时间我忘记了 root 密码。我已经谷歌它,如何重置,问题似乎他无法创建较低的测试文件,因为他试图访问我的 Windows PC 上的 Unix 路径:),哈哈。xamp 配置。
the resetroot.bat gives me this output:
resetroot.bat 给了我这个输出:
101108 15:37:23 [Warning] Can't create test file \usr\local\mysql\data\MYCOMPUTERNAME.lower-test 101108 15:37:23 [Warning] Can't create test file \usr\local\mysql\data\MYCOMPUTERNAME.lower-test mysql\bin\mysqld.exe: Can't change dir to '\usr\local\mysql\data\' (Errcode: 2) 101108 15:37:23 [ERROR] Aborting 101108 15:37:23 [Note] mysql\bin\mysqld.exe: Shutdown complete Passwoerter fuer Benutzer "root" und "pma" wurden nicht geloescht! Passwords for user "root" and "pma" were not deleted! Press any key to continue . . .
The .bat file has the following important parts:
.bat 文件包含以下重要部分:
PUSHD %~dp0 CD .. mysql\bin\mysqld.exe --no-defaults --bind-address=127.0.0.1 --bootstrap --console --skip-grant-tables --skip-innodb --standalone resetroot.err 2>&1 IF ERRORLEVEL 1 GOTO FEHLER GOTO KEINFEHLER :FEHLER TYPE resetroot.err ECHO. ECHO Passwoerter fuer Benutzer "root" und "pma" wurden nicht geloescht! ECHO Passwords for user "root" and "pma" were not deleted! GOTO WEITER :KEINFEHLER ECHO. ECHO Passwoerter fuer Benutzer "root" und "pma" wurden geloescht. ECHO Passwords for user "root" and "pma" were deleted. ECHO. ECHO Bitte den MySQL Server neu starten. ECHO Please restart the MySQL server. GOTO WEITER :WEITER DEL resetroot.err >nul 2>&1 DEL resetroot.sql >nul 2>&1 ECHO. POPD PAUSE
at mysql bin directory is a my.ini file
在 mysql bin 目录下是一个 my.ini 文件
# Point the following paths to different dedicated disks tmpdir = "C:/xampp/tmp/"
Don't know from where is coming that Unix path and where to change, what parameter.
不知道 Unix 路径从哪里来,在哪里更改,什么参数。
Is there any other way to reset the mysql root password until I have this errors?
在出现此错误之前,还有其他方法可以重置 mysql root 密码吗?
回答by AndreKR
I'd suggest to forget the bat file and do it manually:
我建议忘记 bat 文件并手动执行:
- Go to your xampp\mysql\bin\ folder
- Edit my.iniand insert
skip-grant-tables
below[mysqld]
- Restart MySQL
- Set new password for your root user by running
UPDATE mysql.user SET Password=PASSWORD('new_password') WHERE User='root'
in phpMyAdmin in the mysqldatabase (or just leave it like this if MySQL cannot be accessed from remote hosts)
- 转到您的 xampp\mysql\bin\ 文件夹
- 编辑my.ini并在
skip-grant-tables
下面插入[mysqld]
- 重启 MySQL
- 通过
UPDATE mysql.user SET Password=PASSWORD('new_password') WHERE User='root'
在mysql数据库中的 phpMyAdmin 中运行来为您的 root 用户设置新密码(如果无法从远程主机访问 MySQL,则保持这样)
回答by Hammad Khan
In short goto
总之转到
and there you can reset the password. It is web interface rather than you have to look for a file somewhere.
在那里你可以重置密码。它是 Web 界面,而不是您必须在某处查找文件。
回答by enam
I face the same problem & simply update the password with below SQL query With HeidiSQL (Free mySQL editor).
我面临同样的问题,只需使用 HeidiSQL(免费的 mySQL 编辑器)使用以下 SQL 查询更新密码。
UPDATE mysql.user SET Password=PASSWORD('your_password') WHERE User='root'
Then, stop mysql
from xampp
control panel & start it again.
然后,mysql
从xampp
控制面板停止并重新启动。