Reputation: 731
I am unable to connect to my MySQL in xampp I have this error:
MySQL said: Documentation
#1045 - Access denied for user 'root'@'localhost' (using password: NO) 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.
CONFIG.INC.PHP file
<?php
/*
* This is needed for cookie based authentication to encrypt password in
* cookie
*/
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */
/*
* Servers configuration
*/
$i = 0;
/*
* First server
*/
$i++;
/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';
/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';
/* Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
/*
* End of servers configuration
*/
?>
Upvotes: 31
Views: 275768
Reputation: 328
If you are using macbookpro and getting this error on XAMPP then you also need to change the permission of file config.inc.php. Sorry I was first time user of xampp on macbook pro and was not knowing its directory structure and other details so adding this answer for first time users.
From XAMPP interface click to 'go to Terminal' and from there use below commands
root@debian: cd /opt/lampp/phpmyadmin
inside this directory you will find the config.inc.php Now use chmod 777 config.inc.php, please note that you need to make it writable you can use equivalent code instead of 777. I used 777 for me.
root@debian: chmod 777 config.inc.php
Now open the file from explorer or network drive to any editor make the below changes -
search for 'Authentication type' in file, you will find it in comment
below this comment you will find
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'here_you_need_to_type_your_root_password';
now it still didnot work for me after this step, it was complaining about config file permission so I had to revert back the permission back to -rw-r--r-
root@debian: chmod 644 config.inc.php
and then it worked fine.
Upvotes: 2
Reputation: 281
When you install the WAMPP in your machine by default the password of PhpMyAdmin is blank. so put root in user Section and left blank of password field. hope it works.
Upvotes: 0
Reputation: 527
Change the value of
$cfg['Servers'][$i]['user'] = 'groot';
$cfg['Servers'][$i]['password']='groot';
in your ~/xampp/phpMyAdmin/config.inc.php
Here my username is groot and password is groot.
Upvotes: 9
Reputation: 121
You may have set different passwords for user 'root' or have been changed your password. I had the same error as:
mysqli_real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)
and I found that my root password for PHPMyAdmin is not the same on both 'mysql' and 'phpmyadmin' databases, so I updated my password for 'phpmyadmin' database same as 'mysql' database as follow:
sudo gedit /etc/phpmyadmin/config-db.php
and update the fields
$dbuser='root';
$dbpass='myNewPassword'; <-- update your new password here
Upvotes: 12
Reputation: 500
It happened with me before: go to path for windows
C:\xampp\phpMyAdmin\
go to path for linux:
/etc/phpmyadmin/
found file name is :
config.inc.php
open file
change this:
['password'] = ''
to:
['password'] = 'root'
this default
It might be any password if you changed it from the control panel
Upvotes: 7
Reputation: 31
Please run and re reconfigure your phpmyadmin
sudo dpkg-reconfigure phpmyadmin
Upvotes: 0
Reputation: 61
Check /etc/phpmyadmin/config-db.php file
Upvotes: 0
Reputation: 239
Go got XAMPP->mysql->bin->my.ini
open the file with an editor and add 'skip-grant-tables' after mysql.
Upvotes: 1
Reputation: 23
$cfg['Servers'][$i]['auth_type'] = 'HTTP';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '1234';
This solves my problem too. It just logs in automatically.
Upvotes: 3
Reputation: 184
You need to modify the config-db.php
and set your password to the password you gave to the user root
, or else if he has no password leave as this ''
.
Upvotes: 4
Reputation: 660
This is the Different Solution, Check if your Services are running correctly, if WAMP icon showing orange color, and 2 out of 3 services are running it's showing, then this solution will work . Root cause:
If in your system mysql was there, later you installed WAMP then again one MYSQL will install as WAMP package, default port for MYSQL is 3306 , So in both mysql the port will be 3306, which is a port conflict, So just change the port it will work fine. Steps to change the Port.
Upvotes: 2
Reputation: 11
In case none of the aforementioned solutions works for you, then simply do the under changes. Change this
$cfg['Servers'][$i]['host'] = '127.0.0.1';
to
$cfg['Servers'][$i]['host'] = 'localhost';
and
$cfg['Servers'][$i]['auth_type'] = 'config';
to
$cfg['Servers'][$I]['auth_type'] ='cookies';
It works in my situation, possibly works on your situation also.
Upvotes: 1
Reputation: 111
Follow these steps- 1.go to config.inc.php file and find - $cfg['Servers'][$i]['auth_type']
2.change the value of $cfg['Servers'][$i]['auth_type'] to 'cookie' or 'http'.
3.find $cfg['Servers'][$i]['AllowNoPassword'] and change it's value to true.
Now whenever you want to login, enter root as your username,skip the password and go ahead pressing the submit button..
Note- if you choose authentication type as cookie then whenever you will close the browser and reopen it ,again you have to login.
Upvotes: 4
Reputation: 101
Just do what the message is asking for, create the user pma@localhost in the phpMyAdmin panel with no password
Upvotes: 0
Reputation: 49
Edit the file xampp/mysql/bin/my.ini
Add
skip-grant-tables
under [mysqld]
Upvotes: 4
Reputation: 189
/* Authentication type and info */
$cfg['Servers'][$i]['password'] = '';<----your password
or
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';
to
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'your user';
$cfg['Servers'][$i]['controlpass'] = 'your password';
Upvotes: 18
Reputation: 731
found a solution, in my config file I just changed
$cfg['Servers'][$i]['auth_type'] = 'config';
to
$cfg['Servers'][$i]['auth_type'] = 'HTTP';
Upvotes: 41