Home >Database >Mysql Tutorial >How to set mysql login password?

How to set mysql login password?

青灯夜游
青灯夜游Original
2020-09-30 11:19:1711646browse

Setting method: 1. Use the "set password =password('your password');" command; 2. Use the "update user set password=password('your password') where user='root ';"Order.

How to set mysql login password?

mysql settings password

There are many ways:

1. After entering mysql with root

mysql>set password =password('你的密码');
mysql>flush privileges;

2. Use the GRANT statement

mysql>grant all on *.* to 'root'@'localhost' IDENTIFIED BY '你的密码'with grant option ; 
mysql>flush privileges;

3. Enter the mysql library to modify the user table

mysql>use mysql;
mysql>update user set password=password('你的密码') where user='root';
mysql>flush privileges;

Recommended tutorial: mysql video tutorial

The above is the detailed content of How to set mysql login password?. 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