Solve the problem of resetting the Mysql root user account password

Solve the problem of resetting the Mysql root user account password

Problem description:

The following error message appears when executing a command using mysqladmin.exe:

mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: YES)'

Workaround

As follows, reset the mysql root user password

# service mysqld stop
# Enter the mysql installation directory/bin directory (if no relevant environment variables are configured, the following operations are all performed after entering this directory), and perform the following operations# mysqld_safe --skip-grant-tables # Start mysql

Create a new console and execute the following command

# mysql -uroot -p Press Enter to enter the mysql console> use mysql;
> update user set password=password("123456") where user="root"; #Change the root password to 123456
> flush privileges; 
> quit
# service mysqld restart
# mysql -uroot –p123456 #Login

Appendix: Linux xampp integrated environment mysql root password reset method

1. Stop the MySQL server

sudo /opt/lampp/lampp stopmysql

2. Start mysqld with the `--skip-grant-tables' parameter

sudo /opt/lampp/sbin/mysqld --skip-grant-tables

3. Create a new shell terminal and execute the following command

sudo /opt/lampp/bin/mysql –uroot # After the command is executed, it will directly enter the mysql command console

4. Connect to MySQL permission database

use mysql;

5. Change the root user password

update user set password=password("123456") where user="root";

Note: Here 123456 is the new password to be set for the root user

6. Refresh the permission table

flush privileges;

7. Exit mysql

quit;

8. Restart mysql service

sudo /opt/lampp/lampp startmysql

9. Restart XAMPP

/opt/lampp/./lampp restart

Summarize

The above is the solution to the problem of resetting the Mysql root user account password introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to your questions in time.

You may also be interested in:
  • The best solution for resetting the root password of MySQL 8.0.23
  • How to reset the root password in Linux mysql-5.6
  • The easiest way to reset mysql root password
  • Complete steps to reset the root user password in mysql8
  • How to reset the root password in mysql8.0.12
  • MySQL/MariaDB Root Password Reset Tutorial
  • Tutorial on resetting the root password of Mac MySQL
  • How to reset MySQL root password under Windows
  • Two ways to reset the root password of MySQL database using lnmp
  • How to Reset MySQL or MariaDB Root Password in Linux
  • Tutorial on resetting the root password of MySQL under CentOS
  • How to reset MySQL root password

<<:  Detailed explanation of psql database backup and recovery in docker

>>:  Detailed explanation of fs module and Path module methods in Node.js

Recommend

Facebook's nearly perfect redesign of all Internet services

<br />Original source: http://www.a-xuan.cn/...

Correct use of Vue function anti-shake and throttling

Preface 1. Debounce: After a high-frequency event...

Implementation of scheduled backup in Mysql5.7

1. Find mysqldump.exe in the MySQL installation p...

How to use JS to implement waterfall layout of web pages

Table of contents Preface: What is waterfall layo...

Brief analysis of the various versions of mysql.data.dll driver

Here is the mysql driver mysql.data.dll Notice: T...

How to use not in to optimize MySql

Recently, when using select query in a project, I...

How to redirect to https through nginx load balancing

Copy the certificate and key on the web scp -rp -...

Markup language - simplified tags

Click here to return to the 123WORDPRESS.COM HTML ...

A commonplace technique for implementing triangles using CSS (multiple methods)

In some interview experiences, you can often see ...

Detailed explanation of cross-usage of Ref in React

Table of contents 1. First, let’s explain what Re...

Native JS realizes uniform motion of various sports

This article shares with you a uniform motion imp...

Detailed explanation of the use of ElementUI in Vue

Login + sessionStorage Effect display After a suc...