The MySQL console
Open MySQL console from WAMP menu.
Alternatively you can launch ‘MySQL’ from command prompt.
Setting a password for root user
The WAMP bundle does not have a password for the root user by default. You can login right away by hitting the <Enter> key (refer image below).
At the “mysql>” cmd prompt, enter the following line, and press ENTER.
SET PASSWORD FOR root@localhost=PASSWORD('Enter Your Password here');
Note: Replace your password in the place ‘Enter Your Password here’ and make sure you have typed inside the quotes.
A successful password change will look like this.
Now, you have changed the password for MySQL’s root user. But phpMyAdmin will attempt to connect to MySQL using NO password (as configured in config.inc.php), throwing an error as shown below.
To update the mysql password set in phpMyAdmin’s configuration:
- Browse to WampServer phpmyadmin folder, for ex: Installed drive:\Wamp\apps\phpmyadmin3.5.1
- Open the config.inc.php file using Notepad or Wordpad. The file should look like this:
- Replace the empty quotes with the password that you have set for the MySQL and change the ‘AllowNoPassword’ value to false. For ex.
- Save the file and you are done. Now go back to browser and press ” Ctrl + F5 “.
Update password for root user
To update the password at a later stage, use the following command in MySQL console.
mysql> UPDATE mysql.user SET Password=PASSWORD('Your new Password') WHERE User='root';
And do not forget to update your new password in phpMyAdmin’s config file.