Ubuntu安装MySQL 8.0.21更改默认用户密码

2020-08-05  本文已影响0人  dragon海鸟
/etc/mysql$ sudo cat debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = OSozOdppag50NmbG
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password = OSozOdppag50NmbG
socket   = /var/run/mysqld/mysqld.sock
/etc/mysql$ mysql -u debian-sys-maint -p
Enter password: OSozOdppag50NmbG
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';// 123456为新密码
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> quit;
Bye
mysql -uroot -p
上一篇 下一篇

猜你喜欢

热点阅读