運行命令:
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啦