Solution to forgetting mysql password under linux

Solution to forgetting mysql password under linux

The problem is as follows: I entered the command mysql -uroot -p, but I forgot the password.

Step 1: Stop the mysql service

There are methods on the Internet to open /etc/my.cnf and modify it, but I didn't find the file in this directory at all. Maybe it’s due to the version!

Enter the command to stop the mysql service: /etc/init.d/mysql stop

Step 2: Start mysql safely and skip the authorization table: mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

Step 3: Reset MySQL password

Input: mysql -uroot -p. You don’t need to enter a password at this time. Just press Enter to enter.

Enter the statement: use mysql, that is, select a database, enter the statement to reset the password, and I found the following problem, which means that the password column is not included

So the authentication_string column should be modified

Then enter the command: flush privileges to refresh the MySQL system privilege related tables. quit Exit mysql

Step 4: Restart the service and enter the newly set password to log in

Restart the mysql service: /etc/init.d/mysql restart

Enter the password and enter mysql.

For more information, please see the topic: MySQL password operation summary

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to solve the problem of forgetting MySQL password
  • How to modify mysql user password and how to solve mysql password forgetting
  • Detailed explanation of the solution to forget the root password of mysql in windows environment
  • Solution to forgetting the root password of mysql under windows
  • Solution to forgetting mysql password
  • Mysql forgotten password solution

<<:  js to achieve simple calendar effect

>>:  Implementation of Nginx domain name forwarding

Recommend

MySQL Optimization Solution Reference

Problems that may arise from optimization Optimiz...

You may need a large-screen digital scrolling effect like this

The large-screen digital scrolling effect comes f...

Introduction to MySQL <> and <=> operators

<> Operator Function: Indicates not equal t...

Complete steps to use element in vue3.0

Preface: Use the element framework in vue3.0, bec...

Detailed explanation of Vue configuration request multiple server solutions

1. Solution 1.1 Describing the interface context-...

How to use mysqldump to backup MySQL data

1. Introduction to mysqldump mysqldump is a logic...

Web design must also first have a comprehensive image positioning of the website

⑴ Content determines form. First enrich the conten...

JavaScript implements simple scroll window

This article example shares the specific code of ...

Install mysql5.7.17 using RPM under Linux

The installation method of MySQL5.7 rpm under Lin...

Windows 10 + mysql 8.0.11 zip installation tutorial detailed

Prepare: MySQL 8.0 Windows zip package download a...

How to perform query caching in MySQL and how to solve failures

We all know that we need to understand the proper...