使用错误的mysql配置重置root密码
我已经安装了 xampp,我做了安全设置,但过了一段时间我忘记了 root 密码.我已经谷歌它,如何重置,问题似乎他无法创建较低的测试文件,因为他试图访问我的 Windows PC 上的 Unix 路径:),哈哈.xamp 配置.
resetroot.bat 给了我这个输出:
<前>101108 15:37:23 [警告] 无法创建测试文件 \usr\local\mysql\data\MYCOMPUTERNAME.lower-test101108 15:37:23 [警告] 无法创建测试文件 \usr\local\mysql\data\MYCOMPUTERNAME.lower-testmysql\bin\mysqld.exe: 无法将目录更改为 '\usr\local\\mysql\data\' (Errcode: 2)101108 15:37:23 [错误] 中止101108 15:37:23 [注意] mysql\bin\mysqld.exe:关闭完成Passwoerter fuer Benutzer "root" 和 "pma" wurden nicht geloescht!用户root"和pma"的密码没有被删除!按任意键继续 ....bat 文件有以下重要部分:
<前>推拉 %~dp0光盘..mysql\bin\mysqld.exe --no-defaults --bind-address=127.0.0.1 --bootstrap --console --skip-grant-tables --skip-innodb --standalone resetroot.err 2>&1如果错误级别 1 转到 FEHLERGOTO KEINFEHLER:费勒TYPE resetroot.err回声.ECHO Passwoerter fuer Benutzer "root" 和 "pma" wurden nicht geloescht!ECHO 用户root"和pma"的密码没有被删除!转到威特:KEINFEHLER回声.ECHO Passwoerter fuer Benutzer "root" 和 "pma" wurden geloescht.ECHO 用户root"和pma"的密码被删除.回声.ECHO Bitte den MySQL 服务器 neu 启动.ECHO 请重新启动 MySQL 服务器.转到威特:威特DEL resetroot.err >nul 2>&1DEL resetroot.sql >nul 2>&1回声.持久性有机污染物暂停在mysql bin目录下是一个my.ini文件
<前># 将以下路径指向不同的专用磁盘tmpdir = "C:/xampp/tmp/"不知道Unix路径从哪里来,在哪里更改,什么参数.
在出现此错误之前,还有其他方法可以重置 mysql root 密码吗?
解决方案我建议忘记 bat 文件并手动完成:
- 转到您的 xampp\mysql\bin\ 文件夹
- 编辑my.ini并在
[mysqld]
下面插入 - 重启 MySQL
- 通过在 mysql 的 phpMyAdmin 中运行
UPDATE mysql.user SET Password=PASSWORD('new_password') WHERE User='root'
为您的 root 用户设置新密码数据库(或者如果 MySQL 无法从远程主机访问,就保持这样)
skip-grant-tables
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.
the resetroot.bat gives me this output:
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:
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
# 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.
Is there any other way to reset the mysql root password until I have this errors?
解决方案I'd suggest to forget the bat file and do it manually:
- Go to your xampp\mysql\bin\ folder
- Edit my.ini and 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 mysql database (or just leave it like this if MySQL cannot be accessed from remote hosts)
相关文章