Mysql5.7 how to change the root password, mysql5.7 how to change the root password

Source: Internet
Author: User

Mysql5.7 how to change the root password, mysql5.7 how to change the root password

Version update. The password field in the original user has been changed to authentication_string

Because of version updates, many online tutorials are not applicable, and even the documents on the official website cannot be operated smoothly.

If MySQL is running, first:

killall -TERM mysqld。

Run

mysqld_safe --skip-grant-tables &

If you do not want to be remotely connected at this time:

mysqld_safe --skip-grant-tables --skip-networking &

Connect to the server using mysql

Change Password:

update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';

* Note that the Password field is no longer in the user table of the new mysql database.

Instead, the encrypted user password is stored in the authentication_string field.

mysql> flush privileges;mysql> quit;

Modification completed. Restart

killall -TERM mysqld。mysqld_safe &

Then mysql can be connected.

However, at this time, the operation seems to be not fully functional, but also alter user...

alter user 'root'@'localhost' identified by '123';

The net says that the sauce Purple can also:

set password for 'root'@'localhost'=password('123');cp mysql.server /etc/init.d/mysqlchmod +x /etc/init.d/mysqlchkconfig --add mysql

Articles you may be interested in:
  • MySQL 5.7 enhanced version Semisync Replication Performance Optimization
  • How to install the latest MySQL version 5.7.9in mac OS X10.10
  • Mysql5.7 how to forget the root password and mysql5.7 how to change the root password

Related Article

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.