Mac – Modify the file ‘config.inc.php’ for XAMPP, PHPMyAdmin & MySQL setup

macMySQLpermissionsPHPphpmyadmin

I installed XAMPP and subsequently set a password for PHPMyAdmin & MySQL, which requires me to modify the file 'config.inc.php' to add my password to it. However, I simply can't find a way to successfully edit the file without getting a permission or operation error.

No matter what I try, I cannot modify the file to set up a password for PHPMyAdmin.

  1. I have tried logging in as root user using nano to modify the file and I still get permission errors.

  2. I've tried using my normal account and using sudo nano config.inc.php.

  3. I've tried changing permissions on the file to 755 and 777 i.e. chmod 755 config.inc.php.

Currently, due to these issues I can't access PHPMyAdmin at all now. Hoping someone can provide a solution to this nightmare.

Thanks!

EDIT

I'm running MacOS Mojave version 10.14.2, should have specified that my apologies!

When doing an ls -l on the file, I get:

-rw-r–r– 1 daemon daemon 5109 18 Jan 09:40 config.inc.php

Best Answer

Thanks for the info so far, Sam.

The permissions on that file correspond to 644. I would try to run the commands you've listed again, prefacing with sudo as necessary. Here are some steps to correct the issue:

1. Switch the owner of the config.inc.php file with:

sudo chown youruser:youruser config.inc.php

To be sure, you can find your user name by simply running whoami beforehand.

You will be asked to enter your root password for this operation. Make sure you enter it successfully and the command completes. Then run ls -l again and you should see:

-rw-r--r-- 1 youruser youruser 5109 18 Jan 09:40 config.inc.php

This should be plenty for you to be able make use of the file to solve your underlying issue.


2. Try accessing it with the nano command.

3. If for some reason you're denied. Try changing the permissions:

sudo chmod 755 config.inc.php

And ls -l again to make sure it worked.

4. Now try accessing the file again with the nano command.


All of these commands should run and take effect no problem as long as you got the root password correct. If they didn't, that would be really odd and by all accounts shouldn't really happen. If somehow that's the case, please post the exact error message and what step it occurred at. Your system quietly not responding to a sudo authenticated command to simply change a file's permissions would be bizarre.

Related Question