运行命令:
sudo apt-get install -y mysql-server mysql-client
sudo mysql -uroot -p
进入之后:
update mysql.user set plugin="mysql_native_password" where user="root";
grant all on *.* to root@"localhost";
这里我暂时把密码设置为123456
update mysql.user set authentication_string=password('123456') where user='root'and Host = 'localhost';
flush privileges;
然后登录的时候
sudo mysql -uroot -p
输入你之前设置的密码就OK啦