查看mysql8.0安装的默认账号密码
sudo cat /etc/mysql/debian.cnf
文件内容如下
[client]
host = localhost
user = debian-sys-maint
password = voWlZ5cZNV266m8
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = voWlZ5cZNV26k6m8
socket = /var/run/mysqld/mysqld.sock
使用默认账号密码登录mysql
mysql -udebian-sys-maint -pvoWlZ5cZNV26k6m8
查看账号信息
use mysql;
select Host,User,authentication_string from user;
修改root密码
update user set authentication_string=‘‘ where user=‘root‘;
ALTER user ‘root‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘root‘;
flush privileges;
成功后,使用root登录
mysql -uroot -proot