Several solutions for forgetting the MySQL password

Several solutions for forgetting the MySQL password

Solution 1

Completely uninstall and delete all data. First, close all processes related to MySQL. Enter the command line (cmd) and enter taskkill /f /im mysqld-nt.exe

Then find the root directory of MySql and delete it

Solution 2

Enter the password in the command line or change the password

.Run from the command line: taskkill /f /im mysqld-nt.exe

The following operations are to operate some programs in the bin directory of MySQL. If the environment variables are not configured, you need to switch to the bin directory of MySQL and execute the following statements. Otherwise invalid

.Continue to run in the command line: mysqld-nt --skip-grant-tables

3. Open a new command line and run: mysql -u root (If the mysql bin environment variable is not configured, you need to switch to the bin directory to execute this statement)

If you don't want to change the password, but just want to see the original password. You can execute this statement on the command line

select host,user,password from mysql.user; //You can view the user and password

If you want to change the password, execute the following statement in the command line

update mysql.user set password='Fill in the password you want to set here' where user='root';

After completing these operations, continue to run in the command line

taskkill /f /im mysqld-nt.exe; //For safety reasons, end it first, because now you can log in directly with mysql -u root net start mysql; //Start the mysql service

At this point, the solution to the forgotten mysql root password is complete.

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:
  • PHP+MySQL implements login verification to see if the login name and password are correct
  • 4 ways to modify MySQL root password (summary)
  • Steps to initialize the password after the first successful installation of MySQL
  • Solve the problem of changing the password when logging in for the first time after installing MySQL 8.0
  • MySQL 8.0.15 installation and configuration graphic tutorial and password change under Linux
  • Complete steps to configure and install phpMyAdmin in CentOs 7.*
  • How to install and configure phpMyAdmin under centos
  • CentOS7 LNMP+phpmyadmin environment construction Part 3 phpmyadmin installation
  • Tutorial on installing phpMyAdmin on CentOS
  • Solution to the error of accessing phpmyadmin from newly installed XAMPP
  • phpmyadmin3 installation and configuration graphic tutorial
  • When installing phpmyadmin, I get the following error message: Warning: require_once (./libraries/common.inc.php)
  • How to install and configure phpMyAdmin in a virtual host
  • How to install PHPMYAdmin in win2008 IIS7
  • Ubuntu View and modify mysql login name and password, install phpmyadmin

<<:  How to install ELK in Docker and implement JSON format log analysis

>>:  The implementation process of ECharts multi-chart linkage function

Recommend

In-depth analysis of JDBC and MySQL temporary tablespace

background Temporary tablespaces are used to mana...

Detailed explanation of the basic implementation principle of MySQL DISTINCT

Preface DISTINCT is actually very similar to the ...

A detailed introduction to the CSS naming specification BEM from QQtabBar

BEM from QQtabBar First of all, what does BEM mea...

Solution to the problem of passing values ​​between html pages

The first time I used the essay, I felt quite awkw...

Element dynamic routing breadcrumbs implementation example

To master: localStorage, component encapsulation ...

How to automatically backup mysql remotely under Linux

Preface: Basically, whether it is for our own use...

A time-consuming troubleshooting process record of a docker error

Table of contents origin Environmental Informatio...

Solution to the data asymmetry problem between MySQL and Elasticsearch

Solution to the data asymmetry problem between My...

MySQL 8.0.13 installation and configuration method graphic tutorial

This article shares the installation and configur...

Summary of common functions of PostgreSQL regular expressions

Summary of common functions of PostgreSQL regular...

Implementing long shadow of text in less in CSS3

This article mainly introduces how to implement l...

js implements a simple English-Chinese dictionary

This article shares the specific code of js to im...

Simple CSS text animation effect

Achieve results Implementation Code html <div ...

Example of using nested html pages (frameset usage)

Copy code The code is as follows: <!DOCTYPE ht...

Why TypeScript's Enum is problematic

Table of contents What happened? When to use Cont...