Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Login problem of empty password after changing login password in partial version of mariadb database

Shulou Source: shulou.com Published: 2022-06-01 04:03:26 10月06日 Update

The problem that Mariadb database can login with empty password after changing password

Now that you can find this article, I believe you will have some understanding of the data, and I will not repeat the basic knowledge of this database, but here I will give a little explanation to the problem that "the database can log in with an empty password after changing the password and executing the flush privileges command."

When I install the mariadb database, the default password is an empty password. For the sake of safety, you can set a strong secret.

Recurrence problem

MariaDB version: 10.0.36

1. Set the password

Update user set password=password ("password") where user= "root"

Check the password after setting.

As you can see, the password setting is complete, and we have executed the flush privileges command to refresh it. Note that the failure of some friends to execute this command after changing the password will also cause the old password to be used next time (public answer, but it won't solve my problem).

2. Log out and log back in

Log back in to the database

Mysql-u root-p or mysql command

See, you can log in to the database without using a password, and the password you just set is useless. Why is that? It was only after looking up a lot of information that I thought it might be the version of the database.

3. Solve the problem

Since version 5.5.7, plugin has been introduced into the mysql database to authenticate users' passwords, while the default plug-in installed by mariaDB is' console' or 'unix_socket',. This plugin allows you to log in from the console without a password and disable password authentication. And you cannot connect from other clients

Execute in the database mysql

Select user,password,plugins from user

Solving this problem is simple, as long as you leave Plugin empty.

Update user set plugin='' where user='root'

Log in again and you will be asked to enter the password!

Tags: Password data database login question command version plug-in input authentication security again at the same time basic client situation console time friend Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MariaDB OPPO Reno MySQL NVidia