Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error # 1045 - Cannot Log in to MySQL server -> phpmyadmin

We have installed PHPMyAdmin on a windows machine running IIS 7.0.
We are able to connect to MySQL using command-line, But we are not able to connect using PHPMyAdmin.
The error displayed is: Error #1045 Cannot log in to the MySQL server.
Can somebody please help?

PHP Version 5.4.0
mysqlnd 5.0.10 - 20111026 - $Revision: 323634 $
phpMyAdmin-3.5.4-rc1-all-languages.7z

EDIT :
I followed the link below with no success, mean i changed that password but phpmyadmin still has that error...
C.5.4.1.1. Resetting the Root Password: Windows Systems

Also there is thread like below in stack with no help :
Random error: #1045 Cannot log in to the MySQL server
but that error is not random -> i always have that error...

And this is config.inc.php file in phpmyadmin folder:

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Config file view and save screen
 *
 * @package PhpMyAdmin-setup
 */

if (!defined('PHPMYADMIN')) {
    exit;
}

/**
 * Core libraries.
 */
require_once './libraries/config/FormDisplay.class.php';
require_once './setup/lib/index.lib.php';
require_once './setup/lib/ConfigGenerator.class.php';

$config_readable = false;
$config_writable = false;
$config_exists = false;
check_config_rw($config_readable, $config_writable, $config_exists);
?>
<h2><?php echo __('Configuration file') ?></h2>
<?php display_form_top('config.php'); ?>
<input type="hidden" name="eol" value="<?php echo htmlspecialchars(PMA_ifSetOr($_GET['eol'], 'unix')) ?>" />
<?php display_fieldset_top('', '', null, array('class' => 'simple')); ?>
<tr>
    <td>
        <textarea cols="50" rows="20" name="textconfig" id="textconfig" spellcheck="false"><?php
            echo htmlspecialchars(ConfigGenerator::getConfigFile())
        ?></textarea>
    </td>
</tr>
<tr>
    <td class="lastrow" style="text-align: left">
        <input type="submit" name="submit_download" value="<?php echo __('Download') ?>" class="green" />
        <input type="submit" name="submit_save" value="<?php echo __('Save') ?>"<?php if (!$config_writable) echo ' disabled="disabled"' ?> />
    </td>
</tr>
<?php
display_fieldset_bottom_simple();
display_form_bottom();
?>

where part of these codes should i change?

Thanks.

like image 208
SilverLight Avatar asked Nov 13 '12 08:11

SilverLight


People also ask

What is the synonym of error?

Some common synonyms of error are blunder, lapse, mistake, and slip. While all these words mean "a departure from what is true, right, or proper," error suggests the existence of a standard or guide and a straying from the right course through failure to make effective use of this.

What does mean in error?

Definition of in error 1 : not correct : mistaken I believe your conclusion is in error. The judge was in error when she allowed the evidence to be admitted. 2 : in a way that is not correct My earlier statement was made in error.

What is opposite of error?

Antonyms. rightness correctness natural object overgarment better. incorrectness wrongness erroneousness.


5 Answers

In Linux I resolve this problem by going to the root command prompt type:

# mysqladmin -u root password 'Secret Phrase Here'

Then go back and login. Works every time!

like image 197
Jerry Nettrouer II Avatar answered Oct 19 '22 17:10

Jerry Nettrouer II


You need to do two additional things after following the link that you have mentioned in your post:

One have to map the changed login cridentials in phpmyadmin's config.inc.php

and second, you need to restart your web and mysql servers..

php version is not the issue here..you need to go to phpmyadmin installation directory and find file config.inc.php and in that file put your current mysql password at line

$cfg['Servers'][$i]['user'] = 'root'; //mysql username here
$cfg['Servers'][$i]['password'] = 'password'; //mysql password here
like image 15
000 Avatar answered Oct 19 '22 15:10

000


If you are installing first time then please try login with username and password as root

like image 5
Akeel Avatar answered Oct 19 '22 15:10

Akeel


another thing that worked for me after everything didn't - change "localhost" in config.inc.php to 127.0.0.1

like image 5
ItamarBe Avatar answered Oct 19 '22 16:10

ItamarBe


In mysql 5.7 the auth mechanism changed, documentation can be found in the official manual here.

Using the system root user (or sudo) you can connect to the mysql database with the mysql 'root' user via CLI. All other users will work, too.

In phpmyadmin however, all mysql users will work, but not the mysql 'root' user.

This comes from here:

$ mysql -Ne "select Host,User,plugin from mysql.user where user='root';"
+-----------+------+-----------------------+
| localhost | root | auth_socket |
|  hostname | root | mysql_native_password |
+-----------+------+-----------------------+

To 'fix' this security feature, do:

mysql -Ne "update mysql.user set plugin='mysql_native_password' where User='root' and Host='localhost'; flush privileges;"

More on this can also be found here in the manual.

like image 4
sjas Avatar answered Oct 19 '22 16:10

sjas