sdfgg45
sdfgg45

Reputation: 1242

How to change password for MySQL Console in WAMP 2.5

I'm currently running WAMP under Windows 7, I changed my username and password for phpmyadmin.

I cant get my Mysql console working after changing password in phpmyadmin

After the change I get:

access denied for user 'root'@'localhost' (using password yes)

I have tryed to navigate to the mysql folder manual and tryed:

mysql -u username password newpassword

This with no luck of entering the comand line.

Anyone have an good awnser to actually set new password for the command line?

Upvotes: 1

Views: 26670

Answers (4)

Darkcoder
Darkcoder

Reputation: 858

enter image description here
wamp server mysql user id and password

Images Also Available
Hit enter as there is no password. Enter the following commands:

[mysql> SET PASSWORD for 'root'@'localhost' = password('enteryourpassword');
mysql> SET PASSWORD for 'root'@'127.0.0.1' = password('enteryourpassword');
mysql> SET PASSWORD for 'root'@'::1' = password('enteryourpassword');][2]

That’s it, I keep the passwords the same to keep things simple. If you want to check the user’s table to see that the info has been updated just enter the additional commands as shown below. This is a good option to check that you have indeed entered the same password for all hosts.

enter image description here

Upvotes: 2

Nalan Dayarathna
Nalan Dayarathna

Reputation: 34

In WAMP server 3 you might need to change the query to

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

Upvotes: -1

Philipos D.
Philipos D.

Reputation: 2310

Alternatively to your solution you could click the Wamp icon near the clock, Mysql -> service -> remove service, then Mysql -> service -> install service and after this restart all services.

Upvotes: 1

ʰᵈˑ
ʰᵈˑ

Reputation: 11375

This is a straight copy/paste from the manual.

  • Log on to your system as Administrator.
  • Stop the MySQL server if it is running.
  • Create a text file containing the following statements. Replace the password with the password that you want to use.

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

  • Save the file. For this example, the file will be named C:\mysql-init.txt.

  • Open a console window to get to the command prompt: run cmd
  • Start the MySQL server with the special --init-file option (notice that the backslash in the option value is doubled):

    C:> C:\mysql\bin\mysqld --init-file=C:\mysql-init.txt

  • After the server has started successfully, delete C:\mysql-init.txt.

Upvotes: 1

Related Questions