MySQL implements an example method of logging in without a password

MySQL implements an example method of logging in without a password

Specific method:

Step 1: Stop the mysql service

/etc/init.d/mysqld stop

Step 2: Skip password verification

/usr/bin/mysqld_safe --skip-grant-tables

or

mysqld_safe --skip-grant-tables

Start mysql by skipping the privilege tables.

Step 3: Open another command prompt window

use mysql;#Insert the deleted records and then change the password update user set password=password("new_pass") where user="root";

Step 4: Refresh permissions

flush privileges;

Content extension:

Solve the problem of MySQL logging in without a password

Because I executed a command to change the database root user password. After I changed it, I found that I could log in with both the new and old passwords. So I thought I could log in without entering a password and just press Enter. I did not perform password-free login in the configuration. Finally, I executed a command to solve the problem: update user set plugin = "mysql_native_password";

Changing passwords and solving password-less login problems are all in the following commands:

> use mysql;

> update user set authentication_string=password("your password") where user='root'; #(version without password field, that is, version <=5.7)
> update user set password=password('your password') where user='root'; #(version with password field, version>5.7)

> update user set plugin="mysql_native_password"; 

> flush privileges;

> exit;

Restart mysql service

The above is the details of the example method of implementing MySQL login without a password. For more information on how to implement MySQL login without a password, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • Introduction to some operations of MySQL secure password input
  • How to change the secure processing password in MySQL 5.6
  • Quick solution for forgetting MySQL8 password
  • How to retrieve password for mysql 8.0.22 on Mac
  • Detailed explanation of MySQL 8.0 password expiration policy
  • How to change the root user's password in MySQL
  • How to reset the root password in Linux mysql-5.6
  • How to safely shut down MySQL
  • How to gracefully and safely shut down the MySQL process
  • It's the end of the year, is your MySQL password safe?

<<:  js object to achieve data paging effect

>>:  Modification of the default source sources.list file of ubuntu20.04 LTS system

Recommend

Summary of basic usage of $ symbol in Linux

Linux version: CentOS 7 [root@azfdbdfsdf230lqdg1b...

How to solve the 2002 error when installing MySQL database on Alibaba Cloud

The following error occurred while installing the...

MySQL and sqlyog installation tutorial with pictures and text

1. MySQL 1.1 MySQL installation mysql-5.5.27-winx...

Several ways to encrypt and decrypt MySQL (summary)

Table of contents Written in front Two-way encryp...

MySQL Database Indexes and Transactions

Table of contents 1. Index 1.1 Concept 1.2 Functi...

MySQL InnoDB transaction lock source code analysis

Table of contents 1. Lock and Latch 2. Repeatable...

Windows Service 2016 Datacenter\Stand\Embedded Activation Method (2021)

Run cmd with administrator privileges slmgr /ipk ...

CentOS8 - bash: garbled characters and solutions

This situation usually occurs because the Chinese...

Creation, constraints and deletion of foreign keys in MySQL

Preface After MySQL version 3.23.44, InnoDB engin...

How to reset the root password of Mysql in Windows if you forget it

My machine environment: Windows 2008 R2 MySQL 5.6...

Tips for data statistics in MySQL

As a commonly used database, MySQL requires a lot...

VMware15 installation of Deepin detailed tutorial (picture and text)

Preface When using the Deepin user interface, it ...

About ROS2 installation and docker environment usage

Table of contents Why use Docker? Docker installa...

Example explanation of alarm function in Linux

Introduction to Linux alarm function Above code: ...