Problem of retrieving root password in MYSQL 5.7 under Linux (tested and available)

Problem of retrieving root password in MYSQL 5.7 under Linux (tested and available)

1. Retrieve via --skip-grant-tables

(Note: This operation must take security factors into consideration, because the database is not password protected during the period of setting password-free login)

1.1 Modify my.conf and add a new password-free login startup item

vi /etc/my.cnf

Add skip-grant-tables in the [mysqld] area

After the addition is complete, press :wq to save and exit, and restart the mysqld service.

systemctl restart mysqld

1.2 Enter the MySQL console in password-free mode and reset the password

mysql -uroot -p

When entering the password, just press Enter.

Select database mysql

use mysql;

Execute the modify root command

UPDATE user SET authentication_string = password ('Your password. The default password rule requires a combination of uppercase and lowercase letters, symbols, and numbers') WHERE User = 'root';

After successful execution, exit the MySQL database

exit;

1.3 Comment or delete the password-free login configuration item, restart the mysqld service and perform login verification

vi /etc/my.cnf

Restart the mysqld service

systemctl restart mysqld

Log in with new password for verification

mysql -uroot -p

Enter the password and press Enter to submit and verify.

This is the end of this article about retrieving the root password of MYSQL 5.7 under Linux (tested and available). For more information about retrieving the root password of MYSQL 5.7, please search the previous articles of 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to reset MySQL root password
  • Quick solution for forgetting MySQL8 password
  • Solution to forgetting mysql database password

<<:  Html+CSS drawing triangle icon

>>:  vue3 timestamp conversion (without using filters)

Recommend

MySQL 8.0.12 Quick Installation Tutorial

The installation of MySQL 8.0.12 took two days an...

Example of how rem is adapted for mobile devices

Preface Review and summary of mobile terminal rem...

Beginners learn some HTML tags (2)

Beginners can learn HTML by understanding some HT...

How to build a React project with Vite

Table of contents Preface Create a Vite project R...

HTML Tutorial: DOCTYPE Abbreviation

When writing HTML code, the first line should be ...

How to build an ELK log system based on Docker

Background requirements: As the business grows la...

Summary of MySQL database like statement wildcard fuzzy query

MySQL error: Parameter index out of range (1 >...

A record of pitfalls in JS regular matching

I recently discovered a pitfall in regular expres...

Vue implements a simple timer component

When doing a project, it is inevitable to encount...

Tutorial on installing and configuring remote login to MySQL under Ubuntu

This article shares the MySQL installation and co...

Why are the pictures on mobile web apps not clear and very blurry?

Why? The simplest way to put it is that pixels are...

Does MySql need to commit?

Whether MySQL needs to commit when performing ope...

Summary of the pitfalls of using primary keys and rowids in MySQL

Preface We may have heard of the concept of rowid...

JavaScript Composition and Inheritance Explained

Table of contents 1. Introduction 2. Prototype ch...