03-set the root password
1)。 Set the root password for the first time (the default root password is empty)
one
[root@mysql1] # mysqladmin-uroot password '123456'
2)。 Modify root password
one
[root@mysql1] # mysqladmin-uroot-p123456 password '123456789'
one
[root@mysql1] # mysqladmin-uroot-p123456789 password 'hua19900822**'
3) .set password set password
one
two
three
four
five
Mysql > set password=password ('123456'); # change password
Query OK, 0 rows affected (0.00 sec)
Mysql > flush privileges; # synchronize to disk
Query OK, 0 rows affected (0.00 sec)
4) .update statement to change the password
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
seventeen
eighteen
nineteen
twenty
twenty-one
Mysql > use mysql
Database changed
Mysql > select user,host,password from user
+-- +
| | user | host | password | |
+-- +
| | root | localhost | * 6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| | root | mysql1 |
| | root | 127.0.0.1 |
| | root |:: 1 |
| | localhost |
| | mysql1 |
+-- +
6 rows in set (0.00 sec)
Mysql > update user set password=PASSWORD ('789789') where user='root' and host='localhost'
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Mysql > flush privileges
Query OK, 0 rows affected (0.00 sec)