Could not connect to MySQL server - mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)
Posted by: pandafire (---.dhcp.wsco.ca.charter.com)
Date: March 28, 2013 02:41AM

Hi,

I just started learning PHP/MySQL and I tried setting up phpmyadmin but it keeps giving me this error when I try to create a new config file:

Could not connect to MySQL server - mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)

And at the phpmyadmin/ it gives me this error:

#1045 - Access denied for user 'root'@'localhost' (using password: YES)

I am not quite sure what I'm not doing right here. Any help would be greatly appreciated. Thank you!

Options: ReplyQuote
Re: Could not connect to MySQL server - mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)
Posted by: RiggsFolly (---.as13285.net)
Date: March 28, 2013 03:27AM

What do you mean by 'just tried setting up phpmyadmin'. phpMyAdmin comes with wamp and needs no setting up.


Out of the box mysql comes with a userid of 'root' and it has no password ( i.e. its blank)


If you have tried adding a password to the config.inc.php file, then change it back to the way it was originally i.e.
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = true;

Then run phpmyadmin and from within that set a password on the root userid ( all 3 of them, the same password ).

Then come out of phpmyadmin and go back and edit the config.inc.php file and change it to

$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'YOUR NEW PASSWORD';
$cfg['Servers'][$i]['AllowNoPassword'] = false;


That is the correct order of events, assuming I read the correct information from between the lines of what you wrote.

Options: ReplyQuote
Re: Could not connect to MySQL server - mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)
Posted by: pandafire (---.dhcp.wsco.ca.charter.com)
Date: March 28, 2013 04:59AM

I followed the instructions and created a config.inc.php file in a config folder using phpmyadmin/setup/

I only changed the password, everything else is default in that setup section..

After I created it, I took the file out of the config folder and placed it in the phpmyadmin folder.


this is what that config.inc.php file displays:

<?php
/*
* Generated configuration file
* Generated by: phpMyAdmin 3.5.1 setup script
* Date: Thu, 28 Mar 2013 01:36:17 +0000
*/

/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'password';

/* End of servers configuration */

$cfg['DefaultLang'] = 'en';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>

Options: ReplyQuote
Re: Could not connect to MySQL server - mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)
Posted by: cusabio1 (27.17.16.---)
Date: March 28, 2013 06:24AM

This is a wrong code!
/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'password';

www.cusabio.com igg elisa kit

Options: ReplyQuote
Re: Could not connect to MySQL server - mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)
Posted by: RiggsFolly (---.as13285.net)
Date: March 28, 2013 10:22AM

What are you doing !!!

phpMyAdmin comes ready configured with wamp.

The file c:\wamp\apps\phpmyadmin3.5.1\config.inc.php is already setup to work with the out of the box configuration of phpmyadmin and mysql.

c:\wamp\apps\phpmyadmin3.5.1\config.inc.php should look like this:




/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = true;


/* End of servers configuration */

$cfg['DefaultLang'] = 'en-utf-8';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';


/* rajk - for blobstreaming */
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';


Please remove your stuff and replace it with this, phpmyadmin should then work and connect to MySQL in its out of the box state.



When you have used phpmyadmin to change the password on the root user you should change
c:\wamp\apps\phpmyadmin3.5.1\config.inc.php to this

/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
/*
$i++;
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
*/

$i++;

$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['user'] = '';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['Servers'][$i]['LogoutURL'] = 'http://localhost/';


/* End of servers configuration */

$cfg['DefaultLang'] = 'en-utf-8';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';


/* rajk - for blobstreaming */
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';

Note I have commented out the original section and added a new one so if there is a problem you can get back to its initial state.

This will cause the browser to throw a Userid/password dialog every time you run phpMyAdmin so you can enter any userid/password. So if you create more than one user, as you should, one for each database, you can login as any of them at will.

Options: ReplyQuote
Re: Could not connect to MySQL server - mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)
Posted by: pandafire (---.lightspeed.irvnca.sbcglobal.net)
Date: March 28, 2013 05:40PM

Ok, I replaced the old config.inc.php with this code:

/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = true;


/* End of servers configuration */

$cfg['DefaultLang'] = 'en-utf-8';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';


/* rajk - for blobstreaming */
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';



Now when I go to /phpmyAdmin/ it gives me this error:

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

Options: ReplyQuote
Re: Could not connect to MySQL server - mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)
Posted by: pandafire (---.dhcp.wsco.ca.charter.com)
Date: March 29, 2013 01:55AM

Uhhh... It's working now! Thanks everyone for the help!

Options: ReplyQuote
Re: Could not connect to MySQL server - mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)
Posted by: GsmS (61.245.163.---)
Date: June 12, 2014 07:13AM

Ya aaa..its realy working

thank you gyes...

Options: ReplyQuote


Sorry, only registered users may post in this forum.