Quick solution for forgetting MySQL8 password

Quick solution for forgetting MySQL8 password

Preface

When we forget the MySQL database password, we cannot enter the database normally, and we cannot change the password. So how do we change the password at this time? Here we will teach you a simple and commonly used way to change the password.

Here’s how:

1. Open the command line as an administrator;

2. Stop the mysql service:

3. Enter the following command to start MySQL without a password. Many versions found on Baidu modify the my.ini file, but this has no effect in version 8;

mysqld --console --skip-grant-tables --shared-memory

4. Open another DOS window and enter mysql -u root to log in without a password;

5. After logging in, enter the following commands in sequence:

use mysql;
#View username and password select user, host, authentication from user;
#Change password command

Note: When changing the password, I encountered a situation where root@localhost could not be recognized. I think this is related to the fact that I entered the password correctly but could not log in. It has not been verified yet!

Summarize

This is the end of this article about the quick solution to the problem of forgetting the MySQL8 password. For more relevant content about the solution to forgetting the MySQL8 password, please search for previous articles on 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:
  • Problem of retrieving root password in MYSQL 5.7 under Linux (tested and available)
  • How to reset MySQL root password
  • Solution to forgetting mysql database password

<<:  About Docker security Docker-TLS encrypted communication issues

>>:  HTML table tag tutorial (25): vertical alignment attribute VALIGN

Recommend

MySQL SQL Optimization Tutorial: IN and RANGE Queries

First, let's talk about the in() query. It is...

Practical record of vue using echarts word cloud chart

echarts word cloud is an extension of echarts htt...

Docker implements cross-host container communication based on macvlan

Find two test machines: [root@docker1 centos_zabb...

Apply provide and inject to refresh Vue page method

Table of contents Method 1: Call the function dir...

Navicat for MySQL scheduled database backup and data recovery details

Database modification or deletion operations may ...

How to install pip package in Linux

1. Download the pip installation package accordin...

How to quickly copy large files under Linux

Copy data When copying data remotely, we usually ...

Docker modifies the configuration information of an unstarted container

When I first used docker, I didn't use docker...

Architecture and component description of docker private library Harbor

This article will explain the composition of the ...

MySQL 8.0.17 installation and simple configuration tutorial under macOS

If you don’t understand what I wrote, there may b...

Alibaba Cloud Centos7.3 installation mysql5.7.18 rpm installation tutorial

Uninstall MariaDB CentOS7 installs MariaDB instea...

Solution to the conflict between nginx and backend port

question: When developing the Alice management sy...

Solution to Docker image downloading too slowly

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

How to add configuration options to Discuz! Forum

Discuz! Forum has many configuration options in th...