Get the App
SLTechnology News&Howtos  ›  Database  › 

Explain how to reset the MySQL root (Root) password under Redhat Linux (CentOS)

Shulou Source: shulou.com Published: 2022-06-01 21:23:37 10月02日 Update

1. First enter "service mysqld status" to view the current mysql service status, and the following figure shows that the mysqld service is running.

two。 Enter the "killall-TERM mysqld" command to stop all mysqld processes.

3. Enter the "service mysqld stop" command to stop the mysqld service.

4. Enter MySQL security mode without a password by entering the "mysqld_safe-- skip-grant-tables &" command.

5. Enter "mysql-u root" and press enter.

6. Enter "use mysql;" to mount the database.

Note: do not forget to enter the semicolon (;) at the end.

7. Enter "update user set password=password (" Redhat ") where user='root' to change the Root password to New9ssw0rd.

8. Enter "flush privileges;" update permissions.

9. Enter "quit" and press enter to exit.

Note: there is no need to enter semicolons here.

10. Enter "service mysqld restart" to restart the mysqld service.

11. Enter "mysql-u root-p" and press enter to prompt for the password.

twelve。 Enter the new password Redhat and press enter to indicate that you have logged in successfully.

Tags: Enter enter key service password command semicolon in progress prompt security success following figure data database method permissions mode status process new secret update Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Shulou Technology OPPO Reno Xiaomi macOS