Environment: (2020-04-21)
ubuntu LTS 18.04.1
mysql Ver 14.14 Distrib 5.7.29, for Linux (x86_64)
Find a random password
# 显示出mysql安装时的随机密码
sudo cat /etc/mysql/debian.cnf
# 用上面的用户登录
mysql -u debian-sys-maint -p
# 此时输入上面得到的密码
The process is shown in the figure: