Resetting MySQL Root Password with XAMPP on Localhost

后端 未结 15 1563
北荒
北荒 2020-11-30 21:11

So for the past hour I\'ve been trying to figure out how to reset my \'root\' password for MySQL as I cannot log into PHPMyAdmin. I\'ve tried changing the password in the co

相关标签:
15条回答
  • 2020-11-30 21:46

    Follow the following steps:

    1. Open the XAMPP control panel and click on the shell and open the shell.
    2. In the shell run the following : mysql -h localhost -u root -p and press enter. It will as for a password, by default the password is blank so just press enter
    3. Then just run the following query SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpassword'); and press enter and your password is updated for root user on localhost
    0 讨论(0)
  • 2020-11-30 21:50

    SIMPLE STRAIGHT FORWARD WORKING SOLUTION AND OUT OF THE BOX:

    1 - Start the Apache Server and MySQL instances from the XAMPP control panel.

    2 - After the server started, open any web browser and give http://localhost/phpmyadmin/. This will open the phpMyAdmin interface. Using this interface we can manage the MySQL server from the web browser.

    3 - In the phpMyAdmin window, select SQL tab from the top panel. This will open the SQL tab where we can run the SQL queries.

    4 - Now type the following query in the text area and click Go

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

    5 - Now you will see a message saying some thing like: the query has been executed successfully.

    6 - If you refresh the page, you will be getting a error message. This is because the phpMyAdmin configuration file is not aware of our newly set root passoword. To do this we have to modify the phpMyAdmin config file.

    7 - Open the file [XAMPP Installation Path]/phpmyadmin/config.inc.php in your favorite text editor (e.g: C:\xampp\phpMyAdmin\config.inc.php).

    8 - Search for the string

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

    and change it to like this,

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

    Here the ‘password’ is what we set to the root user using the SQL query.

    9 - Now all set to go. Save the config.inc.php file and restart the XAMPP apache and mysql servers. It should work!

    Source: https://veerasundar.com/blog/2009/01/how-to-change-the-root-password-for-mysql-in-xampp/

    DONE!

    0 讨论(0)
  • 2020-11-30 21:54

    Reset XAMPP MySQL root password through SQL update phpmyadmin to work with it:

    -Start the Apache Server and MySQL instances from the XAMPP control panel. After the server started, open any web browser and go to http://localhost/phpmyadmin/. This will open the phpMyAdmin interface. Using this interface we can manager the MySQL server from the web browser.

    -In the phpMyAdmin window, select SQL tab from the right panel. This will open the SQL tab where we can run the SQL queries.

    -Now type the following query in the textarea and click Go

    • "UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';"

    • hit go

    • "FLUSH PRIVILEGES;"

    • hit go

    -Now you will see a message saying that the query has been executed successfully.

    -If you refresh the page, you will be getting a error message. This is because the phpMyAdmin configuration file is not aware of our newly set root passoword. To do this we have to modify the phpMyAdmin config file.

    -Open the file C:\xampp\phpMyAdmin\config.inc.php in your favorite text editor. Search for the string:

    $cfg\['Servers'\]\[$i\]['password'] = ''; and change it to like this, 
    $cfg\['Servers'\]\[$i\]['password'] = 'password'; Here the ‘password’ is what we set to the root user using the SQL query.
    $cfg['Servers'][$i]['AllowNoPassword'] = false; // set to false for password required
    $cfg['Servers'][$i]['auth_type'] = 'cookie'; // web cookie auth
    

    -Now all set to go. Save the config.inc.php file and restart the XAMPP server.

    Modified from Source: http://veerasundar.com/blog/2009/01/how-to-change-the-root-password-for-mysql-in-xampp/

    0 讨论(0)
  • 2020-11-30 21:58

    Open the file C:\xampp\phpMyAdmin\config.inc.php in your text editor. Search for the tags below and edit accordingly

    $cfg['Servers'][$i]['auth_type'] = 'cookie';
    $cfg['Servers'][$i]['user'] = 'root';
    $cfg['Servers'][$i]['password'] = 'password';
    $cfg['Servers'][$i]['extension'] = 'mysqli';
    $cfg['Servers'][$i]['AllowNoPassword'] = true;
    

    Where 'password' is your new password. In-between quotes.

    GO to your browser and visit link http://localhost/phpmyadmin/. Click on 'GO' without your new password. It would log you in and you would be able to see the "CHANGE PASSWORD". Proceed to change your password and you are done.

    0 讨论(0)
  • 2020-11-30 22:00

    You want to edit this file: "\xampp\phpMyAdmin\config.inc.php"

    change this line:

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

    to whatever your password is. If you don't remember your password, then run this command within the Shell:

    mysqladmin.exe -u root password WhateverPassword
    

    where WhateverPassword is your new password.

    0 讨论(0)
  • 2020-11-30 22:00

    On Dashboard, Go to User Accounts, Select user, Click Change Password, Fill the New Password, Go.

    0 讨论(0)
提交回复
热议问题