Sheixt Sheixt - 1 month ago 5
MySQL Question

phpmyadmin in WAMP error #1045 - Need to reset password

I have recently reinstalled WAMP on my PC and copied over files from a back-up I had. I am able to access

localhost
without any problem and my existing sites function fine.

The problem is that I cannot seem to log-in via
http://localhost/phpmyadmin/index.php
. I receive a #1045 Cannot log in to the MySQL server response.

After doing some reading I have been lead to believe that I can edit phpmyadmin's
config.inc.php
file to adjust the settings. After setting my files (as outlined below), I just get a Cannot connect: invalid settings. error.

<?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]['AllowNoPasswordRoot'] = true;

/* 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';

/*
* End of servers configuration
*/

?>


Can someone point out what I can do to resolve the problem?

I am running WAMP 2 using PHP 5.4.12 and mySQL 5.6.12. I've also attempted to log into the mySQL Console in WAMP but I cannot get past the password request...

Answer

If the problem is just a forgotten password this will allow you to reset it. However if you have mixed incompatible databases with MySQL Server versions there will be other problems later once you have reset the password.

Stop the mysql service

wampmanager -> MySQL -> Service -> Stop Service

Edit the my.ini file

wampmanager -> MySQL -> my.ini

Find the [wampmysqld] section in the ini file. Add this line directly after the section [wampmysqld]

skip-grant-tables

Restart the mysql service. wampmanager -> MySQL -> Service -> Start/Resume Service

Open the MySQL console wampmanager -> MySQL -> MySQL Console

Now we are going to reset the password for the root user, of course this could be used to reset any users password. Enter the following 2 commands at the mysql> command prompt, each with a semi colon at the end of a line, and press ENTER after each line to issue the command to mysql.

UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;

*Note that the update should report that it has updated more than one row, that is because there are actually 3 user accounts with the userid of 'root' each with a different domain

i.e. 127.0.0.1, localhost and ::1*

Now enter 'quit' at the mysql command promt to exist mysql.

Stop the mysql service wampmanager -> MySQL -> Service -> Stop Service

Edit the my.ini file wampmanager -> MySQL -> my.ini

Find the [wampmysqld] section in the ini file Remove the skip-grant-tables parameter we added earlier.

DO NOT Leave this parameter in the ini file its a HUGH security hole.

Restart the mysql service. wampmanager -> MySQL -> Service -> Start/Resume Service

Comments