Get the App
SLTechnology News&Howtos  ›  Database  › 

Several methods of modifying password by Mysql in centos7

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

Modify the password

Root changes his own password

Method 1:

Mysqladmin-uroot-pinch 123' password' new_password' / / 123 is the old password

Method 2:

In Mysql

Update mysql.user set authentication_string=password ('Qianfeng123') Where user='root' and host='localhost'

Method 3:

Set the password to which user, and under which user do you want to execute?

Set password=password ("new_password'')

The above method will be in a later version of remove, using the following method

SET PASSWORD='new_password'; sets the password directly

Root changes the passwords of other users

Method 1:

Mysql > SET PASSWORD FOR user3@'localhost'=password ('new_password')

The above method will remove in the future, using the following method:

Mysql > SET PASSWORD FOR user3@'localhost'='new_password'

Method 2:

UPDATE mysql.user SET authentication_string=password ('new_password') WHERE user='user3' AND host='localhost'

Ordinary users change their passwords

Mysql > SET password=password ('new_password'); mysql > select * from mysql.user\ Gmysql > alter user' wing'@'localhost' identified by 'Qianfeng123 thanks

Tags: Method password user faceted normal version Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MySQL Huawei NVidia Docker