php 更改了 phpMyAdmin 的 root 密码,现在我无法访问任何 MAMP
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17794106/
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
Changed root password for phpMyAdmin, now I can't access anything MAMP
提问by mintfiend
I thoroughly searched StackOverflow and Google to find an answer to this and so far nothing has helped. It's killing me because my project was pretty much finished!
我彻底搜索了 StackOverflow 和 Google 以找到答案,但到目前为止没有任何帮助。这让我很伤心,因为我的项目几乎完成了!
In the control panel in phpMyAdmin I changed the password for the root user from 'root' to a new password. When I quit working and came back to it I couldn't connect to the server through MAMP, receiving this error:
在 phpMyAdmin 的控制面板中,我将 root 用户的密码从“root”更改为新密码。当我退出工作并回到它时,我无法通过 MAMP 连接到服务器,收到此错误:
Checking MySQL databases failed. Error message: /Applications/MAMP/Library/bin/mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
检查 MySQL 数据库失败。错误消息:/Applications/MAMP/Library/bin/mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) 当尝试连接时
And this error on my localhost page:
我的本地主机页面上出现此错误:
Error: Could not connect to MySQL server!
错误:无法连接到 MySQL 服务器!
I tried many things to try to resolve this issue, most of which I found from other SO questions. They are as follows:
我尝试了很多方法来尝试解决此问题,其中大部分是从其他 SO 问题中找到的。它们如下:
- Change the password in the config.inc.php file. I couldn't find the other files mentioned, probably because I'm not using Pro. MySQL and PhpMyAdmin config.inc.php Password issue on MAMP
- Change the user and password
$cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'NewPassword';
to blank values and add$cfg['Servers'][$i]['AllowNoPassword'] = false;
. Changed password in phpMyAdmin on a Mac using XAMPP, now unable to access localhost/phpmyadmin - Used terminal to change the password back to 'root', and change config.inc.php back to default. http://www.mamp.info/en/documentation/faq.html#q9
- Tried step 2 without 'AllowNoPassword'
- Changed
$cfg['Servers'][$i]['host'] = 'localhost';
to$cfg['Servers'][$i]['host'] = '127.0.0.1';
- 更改 config.inc.php 文件中的密码。我找不到提到的其他文件,可能是因为我没有使用 Pro。MAMP 上的 MySQL 和 PhpMyAdmin config.inc.php 密码问题
- 将用户和密码更改
$cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'NewPassword';
为空值并添加$cfg['Servers'][$i]['AllowNoPassword'] = false;
. 使用 XAMPP 在 Mac 上的 phpMyAdmin 中更改密码,现在无法访问 localhost/phpmyadmin - 使用终端将密码改回“root”,并将 config.inc.php 改回默认值。http://www.mamp.info/en/documentation/faq.html#q9
- 在没有“AllowNoPassword”的情况下尝试了第 2 步
- 改变
$cfg['Servers'][$i]['host'] = 'localhost';
以$cfg['Servers'][$i]['host'] = '127.0.0.1';
I tried a bunch of other things like changing the auth_type to html, adding controluser and controlpass, and other things but no luck. Nothing seems to work.
我尝试了很多其他的事情,比如将 auth_type 更改为 html、添加 controluser 和 controlpass 以及其他事情,但没有运气。似乎没有任何效果。
采纳答案by Anigel
If you have tried the old password and it still did not work, then you can try changing the password again.
如果您尝试过旧密码但仍然无效,那么您可以再次尝试更改密码。
http://www.mamp.info/en/documentation/faq.html#q9
http://www.mamp.info/en/documentation/faq.html#q9
EDIT
编辑
In order to debug if it is the MySQL or PHPMyAdmin that is the problem now, please try this.
为了调试现在是 MySQL 还是 PHPMyAdmin 的问题,请尝试这个。
Access MAMP's MySQL from Terminal
See if you can connect to mysql on the command line, if you can then we know it is your phpmyadmin config that is wrong, if not then it is the mysql server that is wrong.
看看你是否可以在命令行上连接到 mysql,如果可以,那么我们知道是你的 phpmyadmin 配置有问题,如果没有,那就是 mysql 服务器有问题。
回答by SenhorLucas
Seriously, this is super easy to solve. Edit this line in the phpmyadmin/config.ini.php:
说真的,这非常容易解决。在phpmyadmin/config.ini.php 中编辑这一行:
$cfg['Servers'][$i]['auth_type'] = 'config';
Just replace "config" by "cookie", so your like now looks like this
只需将“config”替换为“cookie”,这样你的喜欢现在看起来像这样
$cfg['Servers'][$i]['auth_type'] = 'cookie';
Now you'll be asked your password.
现在你会被问到你的密码。
ps.: undo all your previous edits to this file trying to solve the problem, and do notwrite the root password in it. If you don't remember your edits, just start over by using phpmyadmin/config.sample.ini.php
PS:撤销先前所有的编辑这个文件要解决的问题,也没有写在它的根密码。如果您不记得您的编辑,只需使用phpmyadmin/config.sample.ini.php重新开始
回答by JEHR
I ran into this problem as well. After installing MAMP I changed the root mySQL password using phpMyAdmin. After having done so, I started getting the 1045 access error message. I then tried changing the phpMyAdmin config file as the documentation instructs. The error, however, persisted.
我也遇到了这个问题。安装 MAMP 后,我使用 phpMyAdmin 更改了 root mySQL 密码。这样做之后,我开始收到 1045 访问错误消息。然后我尝试按照文档说明更改 phpMyAdmin 配置文件。但是,错误仍然存在。
I had been trying to use textedit.app to change the config file. After being baffled for about 30 minutes I noticed the character "'" in the config file was slightly different after using textedit.app. I then loaded the config file into NetBeans and made the changes (changed password from 'root') and everything worked fine. The only change I made to the config file was with the password.
我一直在尝试使用 textedit.app 来更改配置文件。困惑了大约 30 分钟后,我注意到使用 textedit.app 后配置文件中的字符“'”略有不同。然后我将配置文件加载到 NetBeans 并进行更改(从“root”更改密码),一切正常。我对配置文件所做的唯一更改是使用密码。
Perhaps others are having the same issue with subtle changes in characters caused by the editor???
也许其他人也有同样的问题,编辑造成的字符细微变化???
回答by dny238
My access denied error was actually based on file permissions. I created this script to help me fix all the databases. I run it inside the mysql directory that contains a folder per database. Hope it helps others
我的访问被拒绝错误实际上是基于文件权限。我创建了这个脚本来帮助我修复所有数据库。我在每个数据库包含一个文件夹的 mysql 目录中运行它。希望它能帮助别人
vim fixperms.sh
#!/bin/sh
for D in `find . -type d`
do
echo $D;
chown -R mysql:mysql $D;
chmod -R 660 $D;
chown mysql:mysql $D;
chmod 700 $D;
done
echo Dont forget to restart mysql: /etc/init.d/mysqld restart;
回答by mti2935
If you have root access (by way of SSH or by way of the console) to the machine that MySQL is running on, then you can change or reset the MySQL root password by following the procedure at: http://dev.mysql.com/doc/refman/5.6/en/resetting-permissions.html.
如果您对运行 MySQL 的机器具有 root 访问权限(通过 SSH 或通过控制台),那么您可以按照以下过程更改或重置 MySQL root 密码:http://dev.mysql。 com/doc/refman/5.6/en/resetting-permissions.html。
回答by Robin
I extracted this answer/information from Larry Ullmans PHP for the web book, and it worked for me.
我从 Larry Ullmans PHP 为网络书籍提取了这个答案/信息,它对我有用。
Through your Windows browser access:
通过您的 Windows 浏览器访问:
C:\xampp\phpMyAdmin
find the config.inc file, open it, change the following line:
找到config.inc文件,打开它,修改下面一行:
$cfg['Servers'][i]['password'] = 'AND HERE INSERT THE PASSWORD YOU USED FOR ROOT';
Save the file, open phpmyadmin in your browser/localhost, and you are good to go.
保存文件,在浏览器/本地主机中打开 phpmyadmin,一切顺利。
回答by Simanto
this for for the users who uses mamp
这适用于使用 mamp 的用户
1) Stop the MAMP Sarvers
1) 停止 MAMP Sarvers
2) From terminal paste following code
2)从终端粘贴以下代码
/Applications/MAMP/Library/bin/mysqld_safe --skip-grant-tables --skip-networking --socket=/Applications/MAMP/tmp/mysql/mysql.sock --lower_case_table_names=0 --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid &
3) Then log in mysql by using this code
3)然后使用此代码登录mysql
/Applications/MAMP/Library/bin/mysql
4) Reset Mysql Root password by
4)通过以下方式重置Mysql Root密码
UPDATE mysql.user SET Password=PASSWORD('NewPassword') WHERE User='root';
5) Press enter, then type:
5)按回车,然后输入:
FLUSH PRIVILEGES;
回答by John Rodriguez
How funny we change the password for security, but in order to successfully get it done and access phpMyadmin without issues, it needs to be typed in the configuration file where anyone can see it.
我们为了安全而更改密码是多么有趣,但是为了成功完成它并毫无问题地访问 phpMyadmin,需要将它输入到任何人都可以看到的配置文件中。