Jump to content

1045 - Access denied for user 'root'@'localhost' (using password: NO – phpmyadmin


Recommended Posts

Posted

Hi

 

I have googled this error message and to be honest I don’t understand a word of it. I get this when I try and gain access to phpmyadmin I was wondering if someone can help please?

 

Cheers

 

Z

Posted

If i remeber this error from when I ran into it phpmyadmin will not let you connect if you don't have a password set.

 

Check the config.php file for what you need to do, the file is fully commented :)

Posted

This is my config file, the correct password is there.

 

<?php

/*

* Generated configuration file

* Generated by: phpMyAdmin 2.11.7 setup script by Michal ÄŒihaÅ™

* Version: $Id: setup.php 10748 2007-10-10 07:30:59Z cybot_tm $

* Date: Mon, 14 Jul 2008 21:56:49 GMT

*/

 

/* Servers configuration */

$i = 0;

 

/* Server localhost (config:root) [1] */

$i++;

$cfg['Servers'][$i]['host'] = 'localhost';

$cfg['Servers'][$i]['extension'] = 'mysql';

$cfg['Servers'][$i]['connect_type'] = 'tcp';

$cfg['Servers'][$i]['compress'] = false;

$cfg['Servers'][$i]['controluser'] = 'root';

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

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

$cfg['Servers'][$i]['user'] = 'root';

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

 

/* End of servers configuration */

 

?>

 

Thanks for the help

Posted

I use authtype Cookie rather than embed the password into the config thus allowing effectively anybody to get on as root.

 

By using cookie, it will prompt you for a login.

Posted

I would assume that when you installed mySQL on the windows box you specified an admin password and did not leave it empty, if you did supply one then it could be the old password bug.

 

I'll dig out my how too and post it up just incase.

Posted

What mysql client are you using to connect to the mysql database?

 

You may need to tell the mysql client to ask for a password by using the -p command:

 

 

mysql -u root -p -h localhost

 

 

You could also try and reset the root password:

 

MySQL :: MySQL 5.0 Reference Manual :: 12.5.1.6 SET PASSWORD Syntax

 

I quote from the above document:

 

Note

 

If you are connecting to a MySQL 4.1 or later server using a pre-4.1 client program, do not use the preceding SET PASSWORD or UPDATE statement without reading Section 5.4.8, “Password Hashing as of MySQL 4.1”, first. The password format changed in MySQL 4.1, and under certain circumstances it is possible that if you change your password, you might not be able to connect to the server afterward.

 

This was the exact problem I had..... ;)

Posted (edited)
I would assume that when you installed mySQL on the windows box you specified an admin password and did not leave it empty, if you did supply one then it could be the old password bug.

 

I'll dig out my how too and post it up just incase.

 

It didnt ask for one :confused:

 

What mysql client are you using to connect to the mysql database?

 

I am using:

 

MySql: 5.1

PhpMyAdmin: 2.11.7

 

You could also try and reset the root password:

 

I have tried changing the password by using the MySQL Server Instance Config Wizard

 

You may need to tell the mysql client to ask for a password by using the -p command:

 

when i do that i get the attached

phpmyadmin.jpg

Edited by FN-Greatermanchester
Posted

Come out of the MySQL shell and at a normal command prompt put in:

 

mysql -u root -p
and press enter - If it asks for a password, put it in.

 

If it DOESN'T, this means you need to set one using the following syntax (again outside of the MySQL Shell).

 

mysqladmin -u root password "mypasswordr0x"

 

Then use this password in your phpmyadmin config and change the auth type to cookie.

 

Should resolve all of the issues you've outlined.

Posted
Come out of the MySQL shell and at a normal command prompt put in:

 

and press enter - If it asks for a password, put it in.

 

 

Hi thanks for the help.

 

I put the password in then got the attached.

phomyadmin 2.jpg

Posted

OK, so based on that, you need to edit the config file with phpmyadmin and set the auth type to "cookie", don't bother putting in a password as it won't be read.

 

Then visit it and it should prompt you for credentials.

Posted (edited)
Did you remember to rename the sample config.php.dist to config.php, if you used it as a base?

 

i dont seem to have that file :confused:

 

OK, so based on that, you need to edit the config file with phpmyadmin and set the auth type to "cookie", don't bother putting in a password as it won't be read.

 

Then visit it and it should prompt you for credentials.

 

thanks but i have done that still no joy :(

 

Thanks allot

 

Z

Edited by FN-Greatermanchester
Posted

One other thing to bear in mind for the future is that MySQL security is more finely grained than (say) Microsoft SQL Server.

 

If you put the sa password in with MS SQL then you get in. With MySQL you can specify which machines a user can connect from (this can help to make it much more secure - even if a user knows the admin password they can't use it when they've hacked your webserver; they need to hack the db server as well)

 

this can mean that a username and password which will work when you type them directly at the MySQL console won't work when they're in a PHP page running from a different web server.

Posted
i dont seem to have that file :confused:

 

 

 

thanks but i have done that still no joy :(

 

Thanks allot

 

Z

 

What files do you have in your phpmyadmin directory?

Posted
One other thing to bear in mind for the future is that MySQL security is more finely grained than (say) Microsoft SQL Server.

 

If you put the sa password in with MS SQL then you get in. With MySQL you can specify which machines a user can connect from (this can help to make it much more secure - even if a user knows the admin password they can't use it when they've hacked your webserver; they need to hack the db server as well)

 

this can mean that a username and password which will work when you type them directly at the MySQL console won't work when they're in a PHP page running from a different web server.

 

I only have ones set of credentials, will I have to make some more?

 

What files do you have in your phpmyadmin directory?

 

Please fine the attached

 

 

Thanks allot

 

Z

phpmyadmin 3.jpg

Posted
<?php

/*

* Generated configuration file

* Generated by: phpMyAdmin 2.11.7 setup script by Michal ÄŒihaÅ™

* Version: $Id: setup.php 10748 2007-10-10 07:30:59Z cybot_tm $

* Date: Mon, 14 Jul 2008 21:56:49 GMT

*/

 

/* Servers configuration */

$i = 0;

 

/* Server localhost (config:root) [1] */

$i++;

$cfg['Servers'][$i]['host'] = 'localhost';

$cfg['Servers'][$i]['extension'] = 'mysql';

$cfg['Servers'][$i]['connect_type'] = 'tcp';

$cfg['Servers'][$i]['compress'] = false;

$cfg['Servers'][$i]['controluser'] = 'root';

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

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

$cfg['Servers'][$i]['user'] = 'root';

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

 

/* End of servers configuration */

 

?>

 

That file is also in config and libraries

 

Thanks

 

Z

Posted

Nothing's ever simple, I don't use phpmyadmin on windows so I'm perhaps little use.

 

I've just downloaded phpmyadmin from their site and there is no "config" directory and the file doesn't exist in libraries.

 

Grab this, extract it into your "public" space ie wwwpub or whatever its called in IIS land.

 

Copy the config.sample.inc.php file to config.inc.php.

 

It should then "just work" as the same config is set to cookie anyway.

 

Give that a whirl.

Posted

Theres a script to create the config file in the scripts dir. Think its scripts/setup.php (it is on my server)

 

That should let you create the config, you dont need a password if you use cookie auth like kmount said

Posted
Nothing's ever simple, I don't use phpmyadmin on windows so I'm perhaps little use.

 

I've just downloaded phpmyadmin from their site and there is no "config" directory and the file doesn't exist in libraries.

 

Grab this, extract it into your "public" space ie wwwpub or whatever its called in IIS land.

 

Copy the config.sample.inc.php file to config.inc.php.

 

It should then "just work" as the same config is set to cookie anyway.

 

Give that a whirl.

 

Still doesnt work :(

 

Thanks for the help

Posted

Ok to add the chaos, below is what I use for my phpmyadmin config.inc.php file. It will prompt you to login and you should use the same credentials that you use at the mysql command prompt.

 

I recommend you backup your config first

 

Cheers

Jonas

 

$i = 0;

/*
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';

Posted
Ok to add the chaos, below is what I use for my phpmyadmin config.inc.php file. It will prompt you to login and you should use the same credentials that you use at the mysql command prompt.

 

I recommend you backup your config first

 

Cheers

Jonas

 

$i = 0;

/*
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';

 

Is that in the http://localhost/phpmyadmin folder? If so that isnt working :(

 

Thanks

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...