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

The meaning and usage of linux cd

What does linux cd mean? In Linux, cd means chang...

Detailed explanation of Linux index node inode

1. Introduction to inode To understand inode, we ...

Sharing ideas on processing tens of millions of data in a single MySQL table

Table of contents Project Background Improvement ...

TinyEditor is a simple and easy-to-use HTML WYSIWYG editor

A few days ago, I introduced to you a domestic xh...

TypeScript enumeration basics and examples

Table of contents Preface What are enums in TypeS...

How to set MySQL foreign keys for beginners

Table of contents The role of foreign keys mysql ...

Docker builds Redis5.0 and mounts data

Table of contents 1. Simple mounting of persisten...

How to use JavaScript strategy pattern to validate forms

Table of contents Overview Form validation withou...

v-html rendering component problem

Since I have parsed HTML before, I want to use Vu...

Docker Detailed Illustrations

1. Introduction to Docker 1.1 Virtualization 1.1....

How to mount a data disk on Tencent Cloud Server Centos

First, check whether the hard disk device has a d...

Example of fork and mutex lock process in Linux multithreading

Table of contents Question: 1. First attempt 2. R...

Example of implementing QR code scanning effects with CSS3

Online Preview https://jsrun.pro/AafKp/ First loo...

Docker exec executes multiple commands

The docker exec command can execute commands in a...