Get the App
SLTechnology News&Howtos  ›  Servers  › 

What if mysql8.0 forgets his login password?

Shulou Source: shulou.com Published: 2022-06-03 05:16:25 11月14日 Update

What if mysql8.0 forgets his login password? In view of this problem, today the editor summarizes this article about finding the password, hoping to help more students who want to solve this problem to find a more simple and easy way.

Pkill mysqld, shut down mysql.

Skip the permission table of MySQL to start the MySQL service:

-- skip-grant-tables starts mysql

/ usr/local/mysql8013/bin/mysqld_safe-defaults-file=/data/mysql8/my8.cnf-skip-grant-tables &

Leave the password blank:

Root@localhost [(none)] > update mysql.user set authentication_string='' where user= "root" and host= "localhost"; Query OK, 1 row affected (0.06 sec) Rows matched: 1 Changed: 1 Warnings: 0root@localhost [(none)] >

Pkill mysqld, shut down mysql.

Start the mysql service again

[root@localhost] # / usr/local/mysql8013/bin/mysqld-- defaults-file=/data/mysql8/my8.cnf &

Log in to the MySQL service without a password and set a new password:

Root@localhost [(none)] > select version (); +-+ | version () | +-+ | 8.0.13 | +-+ root@localhost [(none)] > alter user user () identified by 'jist558@wei'

[root@localhost ~] # mysql-uroot-paired jist558Wei'e "select version ();"

Mysql: [Warning] Using a password on the command line interface can be insecure.

+-+

| | version () |

+-+

| | 8.0.13 |

+-+

When the password is written into the .my.cnf file, mysql can log in directly to the mysql window:

[root@localhost ~] # cat .my.cnf [mysql] prompt= "\ u@\ h:\ p\ R:\ m:\ s [\ d] >" no-auto-rehashuser=rootpassword=jist558@wei [root@localhost ~] # mysql-e "select version ();" +-+ | version () | 8.0.13 | +-+

About the mysql8.0 forgot login password solution to share here, to solve the problem is not only the article and everyone's analysis of the method, but the accuracy of this analysis is indisputable. For more related content, please follow the industry information channel.

Tags: Password login method question service article more analysis how to do easy to do no doubt easy to do content again accuracy classmates files methods permissions industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Shulou Technology Docker Microsoft Apple