DrueTrue
DrueTrue

Reputation: 175

Can not modify config.inc.php

I changed password in phpmyadmin for root (there was no password actually) and now when I go to phpmyadmin, I receive this error:

MySQL said: Documentation

Cannot connect: invalid settings. mysqli_real_connect(): (HY000/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.

I went to config.inc.php to add the password there, but I can't save modified config.inc.php, it shows that I don't have enough permissions to save it.

I went to google and searched for issues. I tried to change permission through terminal with 644, but it didn't work for me.

I even tried to reinstall XAMPP, but I still get the same error.

Now I have phpmyadmin on my computer, which doesn't work at all and I can't change it.

Please help me, how can I fix it?

Also I am using Mac and XAMPP.

Upvotes: 2

Views: 15078

Answers (3)

San San
San San

Reputation: 159

i have same issue, just follow step by step to fix this

  1. open CMD with Xampp on macOs
  2. apt-get update
  3. apt-get install nano
  4. nano /opt/lampp/phpmyadmin/config.inc.php (and change password or everthing)
  5. save with CTRL + O

Upvotes: 0

Anjum....
Anjum....

Reputation: 4204

Looks like when we install Xampp on mac, it tries to use it's own terminal, it won't work nano by default.

I have done below step which works for me.

  1. Open terminal window (not mac default terminal please check attached image) enter image description here
  2. Then Run apt-get update in the newly opened terminal. This will update some internal dependencies such as

       Get:1 http://security.debian.org stretch/updates InRelease [94.3 kB]       
       Get:3 http://security.debian.org stretch/updates/main amd64 Packages [475 kB]        
       Ign:2 http://cdn-fastly.deb.debian.org/debian stretch InRelease                             
       Get:4 http://cdn-fastly.deb.debian.org/debian stretch Release [118 kB]                      
       Get:5 http://cdn-fastly.deb.debian.org/debian stretch Release.gpg [2434 B]
       Get:6 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 Packages [7090 kB]
       Get:7 http://security.debian.org stretch/updates/main Translation-en [210 kB]   
       Get:8 http://cdn-fastly.deb.debian.org/debian stretch/main Translation-en [5388 kB]                                
       Fetched 13.4 MB in 54s (245 kB/s)                                                                                  
       Reading package lists... Done
    
  3. Then run apt-get install nano this will install nano

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Suggested packages:
      spell
    The following NEW packages will be installed:
      nano
    0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
    Need to get 485 kB of archives.
    After this operation, 2092 kB of additional disk space will be used.
    Get:1 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 nano amd64 2.7.4-1 [485 kB]
    Fetched 485 kB in 3s (130 kB/s)
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_CTYPE = "UTF-8",
        LANG = (unset)
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    debconf: delaying package configuration, since apt-utils is not installed
    Selecting previously unselected package nano.
    (Reading database ... 13080 files and directories currently installed.)
    Preparing to unpack .../nano_2.7.4-1_amd64.deb ...
    Unpacking nano (2.7.4-1) ...
    Setting up nano (2.7.4-1) ..
    
  4. CD to cd ../opt/lampp/phpmyadmin

  5. Open/Edit nano config.inc.php and save.

This way it worked for me :)

Upvotes: 20

Spudley
Spudley

Reputation: 168655

  • Open the Mac command shell.

  • Use the cd command to set the directory to the location of your config.inc.php file.

  • Type the following command:

    sudo nano config.inc.php
    

    You will be asked for your password; enter it. This puts the command into administrator mode.

    This will open the Nano text editor in the command window where you can edit the file. Find the password field (use ctrl+w if you need to search), edit it, and then use ctrl+x to save and exit. You should now be able to use phpMyAdmin again.

Upvotes: 3

Related Questions