Get the App
SLTechnology News&Howtos  ›  Development  › 

How to change mysql password by php

Shulou Source: shulou.com Published: 2022-06-03 10:38:40 11月15日 Update

This article shows you how to change the mysql password by php. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Php changes the mysql password: 1, open the wamp environment, select the myql console; 2, select the database; 3, change the password through "update user set password=password () where user = 'root';".

This article operating environment: Windows7 system, PHP7.1, Dell G3 computer.

How does php change the mysql password? The method of changing password in mysql console in php

In the construction of php environment, it is often encountered that the database link password cannot be set to empty. In addition to opening the option that the database link password is empty, you can also quickly set the default password in the Mysql console and demonstrate it quickly in the wamp environment.

Methods:

Open the wamp environment and select the myql console

Enter the console, press Enter to enter directly if there is no password (I used to have a password here)

After logging in to the Mysql console, select the database

Use mysql

Select a database named Mysql

After the database is selected successfully, start to change the password of the root user

Update user set password=password ('password you set') where user = 'root'

Enter to execute the statement. After the successful execution, refresh it with flush privileges.

That's when the new password takes effect.

The above is how php changes mysql passwords. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Password console data database control selection environment method success content skills knowledge links concise concise that is regular meetings articles more users Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft macOS Xiaomi Apple Shulou Technology