The solution to modify the mysql access password under wamp

  • 2020-06-01 08:55:16
  • OfStack

Learn php, use the wamp installation package to build php + apache + mysql environment, wamp official download address: http: / / www wampserver. com/en /. But wamp the default user name is' root, password is empty. Now I need to change the password to the string I want. My wamp installation directory is "d:\wamp".

After searching on the Internet for 1 time, I have tried many times, but some of them are not feasible. For example, directly modify the file "D:\wamp\apps\ phpmyadmin3.4.10.1 \"

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

Change it to your own password:

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

The user name stays the same as 'root', and then you restart wamp, and it doesn't work.

You should log into the mysql client first. Since the initial password is empty, press enter directly to enter the mysql client. Enter sql command: UPDATE user SET Password=PASSWORD('your password') where USER='root'; It is important to note that the semicolon at the end of the sql command is not forgotten, otherwise the sql statement will not take effect. There are blog posts on the Internet that you need to enter "flush priviliges", otherwise the password cannot be saved, but I can do without this step. My version of wamp is 2.2. Next, as mentioned at the beginning of the article, modify the file to replace the previous one

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

Change it to the same password you just changed on the command line.

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

The user name remains the same as 'root', and you can restart wamp at last.

Related articles: