Change the mysql password in linux

Source: Internet
Author: User

Change the mysql password in linux

(Debian system)

1. serviceMySQLstop
2. mysqld_safe -- skip-grant-tables
3. Open another console and continue the following steps
4. log on to mysql-u root with a blank password
5. show databases;
6. use mysql;
7. update user set Password = password ('ts123456') where user = 'root ';
8. flush privileges;
9. quit;
A. mysql-u root-p
B. 123456


(CentOS System)


Service mysql stop
Mysqld_safe -- skip-grant-tables &
Mysql-u root-p
Use a blank password to log on
Use mysql;
Update user set authentication_string = Password ('ts123456') where user = 'root ';
Flush privileges;


Set password = PASSWORD ('20140901 ');
Alter user 'root' @ 'localhost' password expire never;
Flush privileges;


This can also solve the following problems:
ERROR 1820 (HY000): You must reset your password using alter user statement before executing this statement.

Mysql local Login

Mysql-u root-p

123456

Mysql Remote Login

Mysql-h 192.168.2.100-u root-p

123456

Enable remote access for mysql

Grant all privileges on *. * to 'root' @ '%' identified by '000000' with grant option;

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.