Get the App
SLTechnology News&Howtos  ›  Database  › 

MySQL 5.7forgot your password.

Shulou Source: shulou.com Published: 2022-06-01 11:56:54 10月03日 Update

Modify configuration file:

[root@MySQL-S mysql]# vim /etc/my.cnf

2. Add the following to the module [mysqld].

skip-grant-tables

3. Restart MySQL.

[root@MySQL-S mysql]# ./ support-files/mysql.server restart

4. Enter with blank password, enter.

[root@MySQL-S mysql]# mysql

Execute statements.

mysql> alter user 'root'@'localhost' identified by '123456';

6. Refresh:

mysql> flush privileges;

Or:

update mysql.user set authentication_string=password('123456') where user='root' and Host = 'localhost';

Tags: Password content file module statement configuration Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Redmi Shulou Information Docker OPPO Reno