Home  >  Article  >  Database  >  How to change the login password in mysql8?

How to change the login password in mysql8?

青灯夜游
青灯夜游Original
2020-10-12 13:42:418146browse

Mysql8 method to change the login password: 1. Log in to mysql; 2. Use the "ALTER USER 'test'@'localhost' IDENTIFIED WITH MYSQL_NATIVE_PASSWORD BY 'new password';" command to change the password.

How to change the login password in mysql8?

(Recommended tutorial: mysql video tutorial)

How to change the login password in mysql8?
Example: Modify the mysql database The login password of the test user in the user table.
MySQL version number: 8.0.15

Steps:

1. Log in to mysql

mysql -u root -p
输入登录密码

2. Use the mysql database

USE mysql

3. Change the password

ALTER USER 'test'@'localhost' IDENTIFIED WITH MYSQL_NATIVE_PASSWORD BY '新密码';

4. Verify whether the change is successful

mysql -u test -p
输入新密码

The above is the detailed content of How to change the login password in mysql8?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn