Regaining access to lost MySQL password for PHPMyAdmin on WAMP

后端 未结 3 1748
北恋
北恋 2020-11-28 08:05

I changed the password for my \'root\'@\'localhost\' account in PHPMyAdmin and like (this person asking here) and locked myself out of PHPMyAdmin on my brow

相关标签:
3条回答
  • 2020-11-28 08:13

    Here is a method that will allow you to reset the MYSQL 'root' password quite simply.

    Stop the mysql service

    wampmanager -> MySQL -> Service -> Stop Service
    

    Edit the my.ini file

    wampmanager -> MySQL -> my.ini
    

    Find the [wampmysqld](32bit) or [wampmysqld64](64bit) 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
    

    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.

    Pre MYSQL version 5.7

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

    Post MYSQL version 5.7 the column name changed

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

    Note that the update may report that it has updated more than one row, that because there may be more than one 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](32bit) or [wampmysqld64](64bit) 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
    

    You should now be able to login with phpmyadmin using the userid 'root' and the new password you have just set for that user.

    0 讨论(0)
  • 2020-11-28 08:21

    Previous answers didn't work for me, since MySQL Console keep me out after pressing intro. Try this:

    Create a file C:\wamp64\mysql-init.txt with this content:

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

    This will reset password to 1234 for user root. Then, run the next command on Windows Command Line:

    C:\wamp64\bin\mysql\mysql5.7.21\bin\mysqld.exe wampmysqld --init-file=C:\\wamp64\\mysql-init.txt
    

    Change paths depending on where is installed WAMP on your file system.

    Finally, restart WAMP services.

    0 讨论(0)
  • 2020-11-28 08:23

    This has worked for my Wampserver64 - 3.1.9. Thanx.

        UPDATE mysql.user SET authentication_string=PASSWORD('MyNewPass') WHERE User='root';
        ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
        FLUSH PRIVILEGES;
    
    0 讨论(0)
提交回复
热议问题