LinuxMySQL password Modification

Source: Internet
Author: User
1) if you have not forgotten the password, you can use UPDATE to directly edit the user table to change the password: Enter the database mysql-urootmysqlgt; usemysql; mysql

1) if you have not forgotten the password, you can use UPDATE to directly edit the user table to change the password: Enter the database mysql-u rootmysqlgt; use mysql; mysql

1) if you have not forgotten the password, you can use UPDATE to directly edit the user table to change the password:

Enter mysql-u root
Mysql> use mysql;
Mysql> UPDATE user SET Password = PASSWORD ('newpass') WHERE user = 'root ';
Mysql> flush privileges;
Or
/Etc/init. d/mysql stop
/Etc/init. d/mysql start


2) If you have forgotten your password:
#/Etc/init. d/mysql stop 1. End the currently running mysql process.
#/Usr/bin/mysqld_safe -- skip-grant-tables 2. Run in mysql security mode and skip permission verification.
# Mysql-u root 3. restart a terminal to log on to mysql as the root user.


Mysql> use mysql; 4. Modify the root user password.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-


Database changed
Mysql> update user set Password = PASSWORD ('root') where User = 'root ';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0


Mysql> exit


#/Etc/init. d/mysql restart 5. End mysql security mode and run mysql in normal mode.
Mysql> update mysql. user set password = PASSWORD ('new password') where User = 'root ';
6. Try your new password.
Mysql> flush privileges;
Mysql> quit

,

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.