无法编辑 config.inc.php
运行:macOS High Sierra 版本 10.13.3,zsh w/iTerm2
Running: macOS High Sierra Version 10.13.3, zsh w/ iTerm2
尝试使用 xampp 设置本地环境,这在过去对我来说效果很好.但是,通过 phpmyadmin 用户界面更改 root 密码后,我现在无法访问 phpmyadmin.
Trying to set up a local environment with xampp, which has worked just fine for me in the past. However, I'm now unable to access phpmyadmin after changing the root password via the phpmyadmin UI.
我正在关注的教程(建议这样做)将我指向 config.inc.php 文件,其中的密码变量也需要更新.不幸的是,我无法编辑此文件.我看到 Stack Overflow 中的其他用户抱怨同样的问题,但返回的答案似乎总是涉及通过 vi 或 nano 进行编辑,这不起作用对我来说也是.这是使用 nano 时发生的情况的示例.
The tutorial I am following (which suggested doing this) pointed me to the config.inc.php file, where the password variable would also need to be updated. Unfortunately, I am unable to edit this file. I've seen other users in Stack Overflow complain of the same issue, but the answer that comes back always seems to involve editing via vi or nano, which doesn't work for me either. Here's an example of what happens when using nano.
我通过 nano 打开文件
I open file via nano
sudo nano config.inc.php
然后我的终端提示我输入系统密码.
My terminal then prompts me for the system password.
进入nano后,我导航到密码变量并输入它:
Once in nano, I navigate to the password variable and enter it:
$cfg['Servers'][$i]['password'] = '[mypassword]';
然后我尝试使用 ctrl+O 进行保存,提示我:
I then attempt to save using ctrl+O, where I'm prompted:
要写入的文件名:config.inc.php
然后在按 ENTER 后收到来自 nano 的错误:
and then after hitting ENTER receive the error from nano:
写入 config.inc.php 时出错:权限被拒绝
我还尝试通过 Sublime Text 3 编辑文件,我的机器会提示我输入用户密码.执行此操作后,我没有收到错误消息,但仍然无法访问 phpmyadmin.我无法使用 chmod 编辑该文件的权限,并且在编辑 config.inc.php 文件后重新启动 mysql 服务器也不起作用.
I've also tried to editing the file via Sublime Text 3, where my machine prompts me to enter the user password. I receive no error message after doing that, but still cannot access phpmyadmin. I am unable to use chmod to edit permissions on the file, and restarting the mysql server after editing the config.inc.php file also does not work.
为什么即使我输入了系统密码,nano 仍会抛出权限被拒绝"错误?
Why is nano throwing the "permission denied" error even after I've entered my system password?
谢谢!
推荐答案
我能够通过 xampp 提供的终端访问 config.inc.php 文件来解决这个问题.
I was able to resolve this by accessing the config.inc.php file via the terminal provided by xampp.
首先,xampp 提供的终端需要安装 nano(用于编辑文件).
First things first, the xampp-provided terminal needed nano (to edit the file) installed.
apt-get update
apt-get install nano
然后我导航到该文件:
cd ../opt/lampp/phpmyadmin
然后用nano打开文件:
Then opened the file with nano:
nano config.inc.php
这终于让我编辑了config.inc.php文件并成功保存.
This finally allowed me to edit the config.inc.php file and successfully save.
相关文章