2

I have just used phpMyAdmin on my local machine for the first time in about 6 months. I am using localhost:8080. I thought I had no password, however when it asks me to log in I put:

username: root
password: [I leave this blank]

I cannot log in.

I do not think I created a new password 6 months ago, but there is a small possibility I did and have now forgotten about it.

So now I am locked out of my phpMyAdmin.

I have tried the solution here by RiggsFolly:

https://stackoverflow.com/questions/29070501/regaining-access-to-lost-mysql-password-for-phpmyadmin-on-wamp

But no luck.

I do the following:

Stop the mysql service

wampmanager -> MySQL -> Service -> Stop Service

Edit the my.ini file

wampmanager -> MySQL -> my.ini

Find the wampmysqld64 section in the ini file Add this line directly after that section heading

skip-grant-tables

Restart the mysql service.

wampmanager -> MySQL -> Service -> Start/Resume Service

Open the MySQL console

wampmanager -> MySQL -> MySQL Console

It asks for the password, but I just tap enter and it seems to skip that. I then get the MySQL> prompt.

I have version 5.7.9 so I enter the following:

UPDATE mysql.user SET authentication_string=PASSWORD('MyNewPass') WHERE User='root';

Sometimes it gives a warning, but I do not know what.

I should then do the following two commands now, but I get a problem:

ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
FLUSH PRIVILEGES;

It says (after the ALTER USER bit):

ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

If I do the obvious thing and stop the service as above and then alter the .ini file again to remove that line. I then restart and retype the ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; command. This time it complains saying I should have just done a password change to make this command. (It basically thinks I have not just done the password change as I have had to shut down the system, alter the ini file and then restart in between the commands.)

So I am stuck at this point getting nowhere fast.

If the ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; and FLUSH PRIVILEGES; had worked, I would have then have had to continue with the following:

At the console mysql> prompt I would then need to type:

quit;

Then stop the mysql service:

wampmanager -> MySQL -> Service -> Stop Service

Edit the my.ini file

wampmanager -> MySQL -> my.ini

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

Restart the mysql service.

wampmanager -> MySQL -> Service -> Start/Resume Service

However, as I am stuck at those two commands with no workaround I remain locked out of phpMyAdmin

  • Sorry but this question is considered off-topic because you have already asked the same question on Stack Overflow, granted that the Pro Webmasters has appended information on what you've tried but it does not make the question any more unique and is considered cross-posting. Since the issue you have is in regards of the operating system and SQL then the more suitable stack would be Server Fault... however you should check for duplicates before reposting and ensure that you have removed any questions on other stacks related to this issue. – Simon Hayter Sep 24 '17 at 18:17

Browse other questions tagged or ask your own question.