MySQL 版本 Server version: 8.0.28-0ubuntu0.20.04.3 (Ubuntu)
登录
mysql -u root -p
修改密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456789';
检查mysql服务状态:
systemctl status mysql
# 刷新权限
mysql> flush privileges;
退出
mysql> exit
命令重启mysql:
systemctl restart mysql