使用XAMPP在Mac上的phpMyAdmin中更改了密码,现在无法访问localhost/phpmyadmin [英] Changed password in phpMyAdmin on a Mac using XAMPP, now unable to access localhost/phpmyadmin

查看:296
本文介绍了使用XAMPP在Mac上的phpMyAdmin中更改了密码,现在无法访问localhost/phpmyadmin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了所有可以找到的有关此内容的帖子,但都无济于事.我已经从计算机中删除了XAMPP文件夹,并从DMG文件中重新安装了它,这当然可以解决问题,但是我想知道将来如何解决它.

I've read all the posts I could find about this, and none helped. I've deleted the XAMPP folder from my computer and reinstalled it from the DMG file, which of course fixed the problem, but I'd like to know how to fix it in the future.

一切如何开始:我已在Macbook(运行Mac OS X v10.7.4)上登录phpMyAdmin.我看到了一条消息,通知我更改root的密码,该密码默认情况下没有密码.我转到管理特权"选项卡,并更改了localhost,webdev和127.0.0.1上root的密码.在每种情况下,我都输入相同的短密码,然后单击生成密码",这将创建三个不同的哈希值.

How it all started: I was logged in to phpMyAdmin on my Macbook (which runs Mac OS X v10.7.4). I saw the message advising me to change the password of root, which by default has no password. I went to the Manage Privileges tab and changed the password for root on localhosts, webdev and 127.0.0.1. In each case, I typed in the same short password and clicked "Generate Password," which created three different hashes.

您知道接下来会发生什么:当我再次尝试访问localhost/phpmyadmin时,我被消息锁定了:

You know what comes next: When I tried to access localhost/phpmyadmin again, I was locked out with the message:

Error

MySQL said: 

#1045 - Access denied for user 'root'@'localhost' (using password: NO) 

phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection.  You should check the host, username and password in your configuration and make sure that  they correspond to the information given by the administrator of the MySQL server. 

因此,我查找了stackoverflow,这建议我在命令行中为root设置密码.我在用户目录中创建了一个".profile"文件,其中包含"export PATH =/opt/local/bin:/opt/local/sbin:/Applications/xampp/xamppfiles/bin:$ PATH".这使我能够启动mysql会话,但是(是菜鸟)我不知道在那之后该怎么办.

So I looked up stackoverflow, which advised me to set the password for root at the command line. I created a ".profile" file in my user directory, with "export PATH=/opt/local/bin:/opt/local/sbin:/Applications/xampp/xamppfiles/bin:$PATH" in it. That enabled me to start a mysql session, but (being a noob) I couldn't figure out what to do after that.

Stackoverflow还建议我可以更改config.inc.php中的密码.我在phpmyadmin/setup/frames/config.inc.php找到了这个文件,但该行

Stackoverflow also advised that I could change the password in config.inc.php. I found this file at phpmyadmin/setup/frames/config.inc.php, but the line

$cfg['Servers'][$i]['password'] = '';

不在那里.我确实在phpmyadmin/libraries/config.default.php中找到该行,但是该文件包含禁止对其进行编辑的可怕警告.我找到了另一个可能的文件phpmyadmin/setup/lib/common.inc.php以及phpmyadmin/scripts/signon.php,但是在所有情况下,我的计算机都阻止我进行任何更改,并说我没有权限.因此,这令人沮丧.

was not in there. I did find that line in phpmyadmin/libraries/config.default.php, but that file contains dire warnings against editing it. I found another likely file, phpmyadmin/setup/lib/common.inc.php, as well as phpmyadmin/scripts/signon.php, but in all cases, my computer prevented me from making any changes, saying I didn't have permissions. So that was frustrating.

我确定这是一个菜鸟错误,或者是其中的几个错误,但是我很好奇地发现,我在stackoverflow上查找的所有内容都没有对我有所帮助.我也希望Mac OS使创建系统文件(例如.profile)和编辑XAMPP文件(例如common.inc.php)等操作变得更容易.但你能做什么呢.

I'm sure this is a rookie mistake, or several of them, but I was curious to find that none of the things I looked up on stackoverflow helped me. I also wish the Mac OS made it easier to do things like create system files (e.g., .profile) and edit XAMPP files (e.g., common.inc.php). But what can you do.

推荐答案

在phpMyAdmin的主安装文件夹中,您必须制作一个 config.inc.php 文件,即您所使用的文件应该在改变.如果您没有该文件,请创建它:

In your main installation folder for phpMyAdmin, you must have made a config.inc.php file, that is the file that you should be changing. Incase you don't have that file, then create it:

在主安装文件夹(pMA)中,您将已经有一个名为 config.sample.inc.php 的文件,其中包含默认配置.复制该文件并将其重命名为 config.inc.php ,您可以直接使用cp命令(导航到所述文件夹后)进行操作:

In the main installation folder(pMA) you would already have a file named: config.sample.inc.php, which contains the default configurations. Make a copy of this file and rename it to config.inc.php, you can do that directly using cp command (after navigating into the said folder):

cp ./config.sample.inc.php ./config.inc.php

现在对该新文件进行一些更改:

Now make a few changes to this new file:

  1. 将条目$cfg['Servers'][$i]['host'] = 'localhost';更改为$cfg['Servers'][$i]['host'] = '127.0.0.1';(因为在某些地方它不起作用)
  2. 编写/更改此行:$cfg['Servers'][$i]['AllowNoPassword'] = false;
  1. Change the entry $cfg['Servers'][$i]['host'] = 'localhost'; to $cfg['Servers'][$i]['host'] = '127.0.0.1'; (as it does not work in some places)
  2. Write/change this line: $cfg['Servers'][$i]['AllowNoPassword'] = false;

注意:对于phpMyAdmin的主安装文件夹,我的意思是phpMyAdmin安装的根文件夹,即/<abc>/<xyz>/phpMyAdmin/.
另外,请先进行第二次更改,并且仅在找不到主机的情况下进行第一次更改

Note: by the main installation folder for phpMyAdmin i mean the root folder of the installation of phpMyAdmin, i.e /<abc>/<xyz>/phpMyAdmin/.
Also make the 2nd change first, and make the 1st change only if the host is not found

这篇关于使用XAMPP在Mac上的phpMyAdmin中更改了密码,现在无法访问localhost/phpmyadmin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆