Get the App
SLTechnology News&Howtos  ›  Database  › 

How does mysql change the root password?

Shulou Source: shulou.com Published: 2022-06-01 18:57:21 10月17日 Update

The root password can be modified in a variety of situations. Details are as follows:

Before setting the root password:

The method of the SET PASSWORD command:

Mysql-u rootmysql > SET PASSWORD FOR 'root'@'localhost' = PASSWORD (' password you want to set')

The method of the mysqladmin command:

Mysqladmin-u root password "password you want to set"

Edit the user table directly by UPDATE:

Mysql-u rootmysql > USE mysql;mysql > UPDATE user SET Password = PASSWORD ('password you want to set') WHERE user = 'root';mysql > FLUSH PRIVILEGES

After setting up root:

The way of mysqladmin:

Mysqladmin-u root password oldpass "the new password you want to set"

Set the root password, but forgot:

Mysqld_safe-- skip-grant-tables&mysql-u root mysqlmysql > UPDATE user SET password = PASSWORD ("the new password you want to set") WHERE user = 'root'; mysql > FLUSH PRIVILEGES

These are the details of various ways for mysql to modify root password. Please pay attention to other related articles for more information.

Tags: Password method command variety new secret content that is situation article method more details Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information NVidia Xiaomi OPPO Reno Apple