Tutorial on how to modify the root password in MySQL 5.7

Tutorial on how to modify the root password in MySQL 5.7

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

Due to version updates, many online tutorials are no longer applicable, and even the official website's documents cannot be operated smoothly.

If MySQL is running, kill it first:

killall -TERM mysqld.

run

mysqld_safe --skip-grant-tables &

If you do not want to be connected remotely at this time: mysqld_safe –skip-grant-tables –skip-networking &

Use mysql to connect to server

change password:

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

*One thing to note is that there is no Password field in the user table under the new version of MySQL database.

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

mysql> flush privileges;
mysql> quit;

The modification is completed. Restart

killall -TERM mysqld.
mysqld_safe &

Then mysql can connect

But the operation seems to be incomplete at this time, and you need to alter user...

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

The online article says that this is also possible:

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

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links

You may also be interested in:
  • How to modify the root user password in mysql 8.0.16 winx64 and Linux
  • How to correctly modify the ROOT password in MySql8.0 and above versions
  • MySQL 5.6 root password modification tutorial
  • Summary of how to modify the root password in MySQL 5.7 and MySQL 8.0
  • Detailed explanation of the idea of ​​installing mysql8.0.11 and changing the root password and connecting navicat for mysql
  • Multiple methods to modify MySQL root password (recommended)
  • How to change the root password in MySQL 5.7
  • Mysql forget the root password and change the root password solution (summary)
  • How to change the root user's password in MySQL

<<:  Vue2/vue3 routing permission management method example

>>:  VMware Workstation Installation (Linux Kernel) Kylin Graphic Tutorial

Recommend

Solution to the routing highlighting problem of Vue components

Preface Before, I used cache to highlight the rou...

Detailed explanation of the marquee attribute in HTML

This tag is not part of HTML3.2 and is only suppo...

How to use time as a judgment condition in MySQL

Background: During the development process, we of...

Detailed example of deploying Nginx+Apache dynamic and static separation

Introduction to Nginx dynamic and static separati...

In-depth understanding of Linux load balancing LVS

Table of contents 1. LVS load balancing 2. Basic ...

Vue+Element UI realizes the encapsulation of drop-down menu

This article example shares the specific code of ...

Detailed explanation of the correct way to open em in CSS

Why do we say “usually 1em=16px”? The default tex...

Detailed explanation of using echarts map in angular

Table of contents Initialization of echart app-ba...

Solution to Docker image downloading too slowly

Docker image download is stuck or too slow I sear...

8 JS reduce usage examples and reduce operation methods

reduce method is an array iteration method. Unlik...

Using vsftp to build an FTP server under Linux (with parameter description)

introduce This chapter mainly introduces the proc...

URL representation in HTML web pages

In HTML, common URLs are represented in a variety ...

JavaScript operation elements teach you how to change the page content style

Table of contents 1. Operation elements 1.1. Chan...