Fix Access denied for user 'root' @ 'localhost' for phpMyAdmin

I am using WAMP Server 2.2 on a PC. In phpMyAdmin (version 5.5.24) I edited the root user (with the localhost host) and gave him the password "root". This turned out to be a big mistake, which I am trying to return. Now, when I go to localhost / phpmyadmin / , I get the database menu on the left, but an error message appears in the main frame:

#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. 

If I go to 127.0.0.1/phpmyadmin , I will not get an error, and everything will be fine.

I tried changing the password of a user without a password; I tried changing the config.inc.php file to add a new password (but this completely excluded phpMyAdmin); I tried to delete and recreate the root / localhost user. Nothing is working. The root / localhost user does not have a password and all privileges, but the error remains.

Any ideas, or how can I get this user to return to normal without reinstalling WAMP?

+44
php mysql phpmyadmin wamp
Oct. 20 '13 at 20:18
source share
15 answers

Find the config.inc file under C:\wamp\apps\phpmyadmin3.5.1 Inside this file, find this one line

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

and replace it with

 $cfg['Servers'][$i]['password'] = 'Type your root password here'; 
+50
Feb 24 '14 at 9:07
source share

I had the same problem after I changed the passwords in the database .. what I did was editing the updated password I changed earlier, and I did not update in config.inc.php and the same username under D: \ xamp \ phpMyAdmin \ config.inc

 $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = **'root'**; $cfg['Servers'][$i]['password'] = **'epufhy**'; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = true; $cfg['Lang'] = ''; 
+22
Oct. 31 '14 at 15:45
source share

After I changed the password for my “root” on the phpMyAdmin page, I had the same problem and also searched for solutions from the Internet, but could not get the answer I needed, so I check the documentation inside the phpMyAdmin directory.

Browse to the file and edit it

 \modules\phpmyadmin414x140123114237\config.sample.inc.php 

find the line

 $cfg['Servers'][$i]['auth_type'] = 'config' 

and change 'config' to 'http' and this will allow you to enter your username and password when going to the phpMyAdmin page using a browser.

OR

see the documentation file in the same phpMyAdmin directory ( phpmyadmin414x140123114237\doc\html ) for help and search for $cfg['Servers'][$i]['auth_type'] , and you will see 4 options for choosing how to enter the page phpMyAdmin.

+12
Feb 05 '14 at 5:28
source share

Well .. It seems very strange to me, but it suddenly worked!

What I did was exactly:

  • Moved to the phpMyAdmin folder and edited the file "config.inc.php"
  • I looked at the line: $ cfg ['Servers'] [$ i] ['password'] = '';
  • Added password between '', let's say '1234'
  • Rebooting localhost / phpmyadmin and 127.0.0.1/phpmyadmin (both showed the same error)
  • Returned "config.inc.php" to its old state (deleted password)
  • Repeat step 4

And suddenly it worked!

+3
Sep 17 '14 at 10:23
source share

using $cfg['Servers'][$i]['auth_type'] = 'config'; unsafe, I think.

use of cookies with $cfg['Servers'][$i]['auth_type'] = 'cookie'; better i think.

I also added:

 $cfg['LoginCookieRecall'] = true; $cfg['LoginCookieValidity'] = 100440; $cfg['LoginCookieStore'] = 0; //Define how long login cookie should be stored in browser. Default 0 means that it will be kept for existing session. This is recommended for not trusted environments. $cfg['LoginCookieDeleteAll'] = true; //If enabled (default), logout deletes cookies for all servers, otherwise only for current one. Setting this to false makes it easy to forget to log out from other server, when you are using more of them. 

I added this in phi.ini

 session.gc_maxlifetime=150000 
+3
Mar 15 '15 at 7:34
source share

If you have an existing password for mysql, write as follows:

Find the config (dot) inc file in C: \ wamp \ apps \ phpmyadmin3.5.1 Inside this file, find one line

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

and replace it with

$cfg['Servers'][$i]['password'] = **'your-password'**;

+3
Apr 05 '15 at 20:24
source share

@ Dagon had the right idea, but was a little shorter in the details.

If you use access 127.0.0.1/phpmyadmin and look carefully at Users who are configured in MysQL, you should see 3 versions of the root username.

This is due to the fact that in MySQL each user identifier is associated with a HOST, that is, with a PC (IP address) from which the user is allowed to enter. So your 3 '' root userid is actually the same user id that is allowed to login from 3 separate HOSTS. Usually out of the box “root” has 3 HOSTS settings, 127.0.0.1, localhost and :: 1

It: -

localhost is an alias for THIS MACHINE created from your HOSTS file (c: \ windows \ system32 \ drivers \ etc \ hosts)

127.0.0.1 - IPv4 loopback IP THIS MACHINE

:: 1 - IPv6 loopback IP address THIS MACHINE

What probably happens to you is that you set a password for root@127.0.0.1, but not for others. Now your browser "arbt temporarily" decides to use :: 1 or 127.0.0.1 as the host IP address, so when it uses :: 1, your login will fail.

So log in with 127.0.0.1/phpmyadmin and change all 3 'root' usernames to have the same password that you should no longer see this problem.

Also make sure your HOSTS file has these 2 entries

 127.0.0.1 localhost ::1 localhost 
+2
Oct 21 '13 at 9:27
source share

To fix the error above: -

 a) Open Mysql console from the tray of WAMP server b) It will ask for password(you might have set this password earlier when u installed MySql in your system)(In my case it is admin) c) Enter admin (press enter) 

Now this means that your phpmyadmin does not accept the password for your MySql and cannot connect to MySql, but you can connect your MySql server with a password

 For this Open config.inc file from the below path C:\wamp\apps\phpmyadmin4.1.14 

And replace this line

 $cfg['Servers'][$i]['password'] =' '; to `$cfg['Servers'][$i]['password'] = 'admin';` 

I hope this works.

+2
Feb 16 '15 at 13:00
source share

What worked for me:

Go to config.inc.php

Change $ cfg ['Servers'] [$ i] ['AllowNoPassword'] = true; in $ cfg ['Servers'] [$ i] ['AllowNoPassword'] = false;

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

to

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

Change

$ cfg ['Servers'] [$ i] ['auth_type'] = 'config';

to

$ cfg ['Servers'] [$ i] ['auth_type'] = 'http';

Reload page http: // localhost / phpmyadmin

Type: root pass: (empty)

Now you have access to it. :)

+2
Mar 11 '16 at 13:50
source share

Locate the config.inc.php file under C: \ xampp \ phpMyAdmin and open it in any editor. Find the following line:

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

Enter your chosen password inside quotation marks. Also, for localhost / phpmyadmin to request a username and password, find the following line:

 $cfg['Servers'][$i]['auth_type'] = 'config'; 

Change the above line to:

 $cfg['Servers'][$i]['auth_type'] = 'cookie'; 
+2
Jun 15 '16 at 7:21
source share

XAMPP \ PhpMyAdmin / config.inc

Search -

$ cfg ['Servers'] [$ i] ['auth_type'] = 'config'

and change "config" to "http" and this will allow you to enter your username and password when you go to the phpMyAdmin page using your browser.

+1
Feb 21 '15 at 2:08
source share

Also note that "setup" (that is, localhost / phpmyadmin / setup) has an error in how it handles the "no password" parameter. While he creates a line that reads:

 $cfg['Servers'][$i]['nopassword'] = true; 

the actual parameter name should be as shown below:

 $cfg['Servers'][$i]['AllowNoPassword'] = true; 

This "install" error exists today, October 20, 2015.

+1
Oct 20 '15 at 16:41
source share

Try to find $ cfg ['Servers'] [$ i] ['password'] = ''; in the configuration file is the file wamp / scripts / config.inc.php

Then set the password for mysql password and update PhpmyAdmin

+1
Dec 25 '15 at 18:46
source share

I also ran into this problem,

I found that the password field is empty in the phpmyadmin configuration file. I put this password, which I filled in the database settings. now it works great

+1
Aug 6 '16 at 9:38 on
source share

I use this URL to enter phpMyAdmin http: // localhost: 2145 / phpmyadmin , but I get the following error:
"phpMyAdmin tried to connect to the MySQL server and the server rejected the connection. You must check the host, username and password in your configuration and make sure that they match the information provided by the MySQL server administrator"
my config.inc.php file

 $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = ''; $cfg['Servers'][$i]['host'] = 'localhost:2145'; $cfg['Servers'][$i]['connect_type'] = 'cookie'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['AllowNoPassword'] = true; /* User used to manipulate with storage */ // $cfg['Servers'][$i]['controlhost'] = ''; // $cfg['Servers'][$i]['controlport'] = ''; $cfg['Servers'][$i]['controluser'] = ''; $cfg['Servers'][$i]['controlpass'] = ''; 

this change will resolve the error for me

 $cfg['Servers'][$i]['auth_type'] = 'cookie'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = ''; /* Server parameters */ $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['AllowNoPassword'] = true; 

and then

 sudo service mysql stop /opt/lampp/lampp start 

and the problem is solved

0
Aug 01 '16 at 15:54
source share



All Articles