将 MySQL 根密码重置为“默认"- MAMP

2022-01-05 00:00:00 terminal mysql mamp phpmyadmin

我在 phpMyAdmin 上更改了我的 root 级别密码.我不确定在哪里输入密码本身,因为它没有给我选项(登录表单).我想知道它是否是 php.ini 文件,但如果我将密码放在那里,则具有读取权限的用户可以读取它.

I changed my root level password on phpMyAdmin. I was unsure where to enter the password itself, as it did not give me the option (login form). I wondered if it was the php.ini file but users with read privileges could read it if I placed the password in there.

现在,mysql 无法运行,因为我尝试了各种在线资源来解决问题.如果需要,我会删除 mamp 并重新安装,但我不想丢失我的数据库文件.理想情况下,我会将密码恢复为默认值,我认为这没什么,除了现在我无法连接到 phpmyadmin 或 mamp 起始页:

Now, the mysql doesn't run as I tried various online resources to fix the problem. If needs be I would delete mamp and re-install but I do not want to lose my database files. Ideally I would revert the password to default, which I believe was nothing, except now I cannot connect to phpmyadmin, or the mamp start page:

Error: Could not connect to MySQL server!

任何帮助都会很棒.

更新 -

来自 mamp 的错误信息:

Error message from mamp:

/Applications/MAMP/Library/bin/mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect

推荐答案

这似乎在使用终端重置密码时已修复:

This seemed to have fixed it when using terminal to reset the password:

/Applications/MAMP/Library/bin/mysqladmin -u root -p password newpassword

在 mamp 常见问题解答上找到.

相关文章