I'm using WAMP Server 2.2 on a PC. In phpMyAdmin (version 5.5.24) I edited the 'root' user (with 'localhost' host) and gave it a password of 'root'. This turned out to be a big mistake that I'm trying to revert. Now when I go to localhost/phpmyadmin/ I get the menu of databases on the left, but the main frame has an error that reads:
#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 do not get the error and everything works fine.
I tried changing the user's password back to no password; I tried modifying config.inc.php file to add the new password (but that made phpMyAdmin error-out completely); I tried removing and recreating the root/localhost user. Nothing seems to work. The root/localhost user appears to have no password and all privileges, but the error remains.
Any ideas or how I can get this user's access back to normal without having to reinstall WAMP?
%windir%\system32\drivers\etc\hosts
file and add/uncomment 127.0.0.1 localhost
in it
Find 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';
I had the same problem after i had changed the passwords in the database.. what i did was the editing of the updated password i had changed earlier and i didn't update in the 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'] = '';
config.inc
(mine was config.inc.php
) and it worked for me.
After I change the password for my "root" in phpMyAdmin page, I had a same problem and also looking for the solutions from the internet but fail to get the answer I needed, so I check the documentation inside the phpMyAdmin directory.
Go to and edit the file
\modules\phpmyadmin414x140123114237\config.sample.inc.php
look for line
$cfg['Servers'][$i]['auth_type'] = 'config'
and change the 'config' to 'http' and that will allow you to type the user name and password when you go to your phpMyAdmin page using your browser.
OR
see the documentation file under the same phpMyAdmin directory (phpmyadmin414x140123114237\doc\html
) for help and search for $cfg['Servers'][$i]['auth_type']
and you will see 4 options to choose from as to how to login to your phpMyAdmin page.
Locate config.inc.php file under C:\xampp\phpMyAdmin and open it in any editor. Find the following line:
$cfg['Servers'][$i]['password'] = ' ';
Enter the chosen password inside the quotes. Also, in order to make localhost/phpmyadmin ask for 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';
If you have existing password for mysql then write as mentioned below :
Find config(dot)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'] = **'your-password'**;
What worked for me:
Go to config.inc.php.
Change
$cfg['Servers'][$i]['AllowNoPassword'] = true;
to
$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 the page http://localhost/phpmyadmin
Type : root pass : (empty)
Now you have access to it. :)
Well .. That seems very odd to me, but it suddenly worked!!
What I did exactly was:
Navigated to phpMyAdmin folder, and edited the file "config.inc.php" Looked for the line: $cfg['Servers'][$i]['password'] = ''; Added any password between '', let's say '1234' Reloaded localhost/phpmyadmin & 127.0.0.1/phpmyadmin (both showed the same error) Reverted "config.inc.php" to the old state (removed the password) Re-did step 4
And suddenly it worked!
@Dagon had the right idea but was a little short on details.
If you use the access 127.0.0.1/phpmyadmin
and have a close look at the Users that are setup in MysQL you should see 3 versions of the root
username.
This is because in MySQL each userid is associated with a HOST, i.e. The PC ( ip address ) that the user is allowed to sign in from. So your 3 `'root' userids are in fact the same userid which is allowed to signin from 3 seperate HOSTS. Normally out of the box the 'root' has 3 HOSTS setup, 127.0.0.1, localhost and ::1
These are :-
localhost is an alias for THIS MACHINE created from your HOSTS file ( c:\windows\system32\drivers\etc\hosts )
127.0.0.1 is the IPv4 loopback ip address of THIS MACHINE
::1 is the IPv6 loopback ip address of THIS MACHINE
What is probably happening to you is that you have set a password for root@127.0.0.1 but not any of the others. Now your browser will 'arbtrarily' decide to use ::1 or 127.0.0.1 as the host ip so when it uses ::1 your login will fail.
So login using 127.0.0.1/phpmyadmin
and change all 3 'root' usernames to have the same password you should no longer see this problem.
Also make sure that your HOSTS file has these 2 entries
127.0.0.1 localhost
::1 localhost
::1 localhost
was the perfect solution in my case. Thanks a ton!
To resolve the above error:-
a) Open Mysql console from the tray of WAMP server
b) It will ask for a 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 it means your PhpMyAdmin is assuming no password for your MySql and unable to connect MySql but you are able to connect your MySql Server by providing the 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 it will work...
using $cfg['Servers'][$i]['auth_type'] = 'config';
is insecure i think.
using cookies with $cfg['Servers'][$i]['auth_type'] = 'cookie';
is 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
I use this URL to enter phpMyAdmin http://localhost:2145/phpmyadmin but get the following error:
"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"
my config.inc.php file is
$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 resolve the mistake 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 problem solved
I faced the same issue with XAMPP and phpMyAdmin and this is how I solved it easily.
go in side the phpMyAdmin folder
root
root
Change them according to your username and password which you have given to MySQL server
xampp\phpMyAdmin/config.inc
Find-
$cfg['Servers'][$i]['auth_type'] = 'config'
and change the 'config' to 'http' and that will allow you to type the user name and password when you go to your phpMyAdmin page using your browser.
Also beware that "setup" (i.e. localhost/phpmyadmin/setup) has an error in the way it handles the "no password" option. While it creates a line that says:
$cfg['Servers'][$i]['nopassword'] = true;
the actual name of the parameter should be as shown here:
$cfg['Servers'][$i]['AllowNoPassword'] = true;
This "setup" error exists as of today, Oct 20, 2015.
Try to find $cfg['Servers'][$i]['password'] = ''; in config file located wamp/scripts/config.inc.php
Then set the password to your mysql password and refresh PhpmyAdmin
i also faced this problem,
i found password field was blank in config file of phpmyadmin. i put that password which i filled in database settings. now it is working fine
Sometimes the config is not always the problem.
Try checking the MySql config. If yuh have changed the port no. on mysql make the similar changes to PHP config php.ini
. Find and replace the necessary changes.
Success story sharing
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Servers'][$i]['password']
in this config file .../xampp/phpMyAdmin/config.inc.php