Home >Database >Mysql Tutorial >What is the mysql initial password?

What is the mysql initial password?

藏色散人
藏色散人Original
2021-12-02 11:32:5268926browse

The initial password of mysql is empty. The method to change the initial password is: 1. Use the empty initial password to log in to the mysql account; 2. Change the root password through statements such as "SETPASSWORD = PASSWORD('123456');" Can.

What is the mysql initial password?

The operating environment of this article: Windows 7 system, Mysql version 5.7.14, Dell G3 computer.

What is the initial password for mysql?

The initial password for mysql is empty.

MySQL has three ways to change the initial password:

Method 1:

1. Use an empty initial password to log in to the mysql account:

mysql-uroot -p

2. Change the root password:

SETPASSWORD = PASSWORD('123456');

Method 2:

1. Use an empty initial password to log in to the mysql account:

mysql-uroot -p

2. Change the root password:

mysqladmin -u root password '123456'

Method three:

1. Use an empty initial password to log in to the mysql account:

mysql-uroot -p

2. Change the root password:

mysql> update user set Password=password("123456") where User='root';
Query OK, 4 rows affected (0.01 sec)
Rows matched: 4  Changed: 4  Warnings: 0
 
mysql> flush privileges;
Query OK, 0 rows affected (0.04 sec)
 
mysql> select Host,User,password from user where user='root';
+-----------------------+------+-------------------------------------------+
| Host                  | User | password                                  |
+-----------------------+------+-------------------------------------------+
| localhost             | root | *5626ED34B75C6C508BA2A3D0A4F6E4C58823138C |
| localhost.localdomain | root | *5626ED34B75C6C508BA2A3D0A4F6E4C58823138C |
| 127.0.0.1             | root | *5626ED34B75C6C508BA2A3D0A4F6E4C58823138C |
| ::1                   | root | *5626ED34B75C6C508BA2A3D0A4F6E4C58823138C |
+-----------------------+------+-------------------------------------------+
4 rows in set (0.00 sec)

[Related recommendations: mysql video tutorial]

The above is the detailed content of What is the mysql initial 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