Mysql User password change, mysql password change _ PHP Tutorial

Source: Internet
Author: User
The mysql user changes the password, and the mysql user changes the password. Mysql User password change, mysql password change 1: Use the SETPASSWORD command to first log on to MySQL. Format: mysqlsetpasswordfor username @ localhostpassword (new password); 2: Use mysq mysql user to change password, mysql to change password

1: Use the set password command
First, log on to MySQL.
Format: mysql> set password for username @ localhost = password ('New password ');

2: Use mysqladmin
Format: mysqladmin-u username-p old password new password

3: Use UPDATE to directly edit the user table
First, log on to MySQL.
Mysql> use mysql;
Mysql> update user set password = password ('000000') where user = 'root' and host = 'localhost ';
Mysql> flush privileges;

4: When you forget the root password
Take windows as an example:
1. disable the running MySQL service.
2. open the DOS window and go to the mysql \ bin directory.
3. enter mysqld -- skip-grant-tables and press enter. -- Skip-grant-tables indicates that the permission table authentication is skipped when the MySQL service is started.
4. open another DOS window (because the DOS window can no longer be moved) and go to the mysql \ bin directory.
5. enter mysql and press Enter. If yes, the MySQL prompt> will appear.
6. connect to the permission database: use mysql ;.
6. change the password: update user set password = password ("123") where user = "root"; (do not forget the last Plus points ).
7. refresh permission (required): flush privileges ;.
8. exit quit.
9. log out of the system and log on again. log on with the username root and the new password 123 you just set.

Login 1: Use the set password command to log on to MySQL first. Format: mysql set password for username @ localhost = password ('New password'); 2: mysq...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.