Home  >  Article  >  Backend Development  >  How to change mysql password in php

How to change mysql password in php

藏色散人
藏色散人Original
2021-09-19 09:19:102819browse

How to change the mysql password in php: 1. Open the wamp environment and select the myql console; 2. Select the database; 3. Pass "update user set password=password() where user = 'root'; "Just change the password.

How to change mysql password in php

#The operating environment of this article: Windows7 system, PHP7.1, Dell G3 computer.

How to change mysql password in php? How to change the password in the mysql console in php

When setting up the php environment, it is often encountered that the database link password cannot be set to empty. In addition to turning on the option of setting the database link password to empty, it can also be controlled in Mysql Desk, quickly set the default password, here is a quick demonstration in the wamp environment

Method:

Open the wamp environment, select the myql console

How to change mysql password in php

Enter the console, press Enter directly if you don’t have a password (I had a password here before)

How to change mysql password in php

After logging in to the Mysql console, select the database

use mysql;

Select the database named Mysql

How to change mysql password in php

After the database selection is successful, start to modify the password of the root user

update user set password=password('你设置的密码')  where user = 'root';

Press Enter to execute the statement, After successful execution, use flush privileges to refresh

The new password will take effect

How to change mysql password in php

Recommended study: "PHP Video Tutorial

The above is the detailed content of How to change mysql password in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn