转载:https://www.cnblogs.com/ahmczsy/p/10489809.html
Ubuntu18.04 修改Mysql5.7默认root密码
$ mysql
//修改验证方式
mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
//修改密码
mysql> update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';
//刷新权限
mysql> flush privileges;
//退出
musql> exit;
重启mysql服务 登陆mysql
mysql -uroot -p