wget https://repo.mysql.com//mysql-apt-config_0.8.25-1_all.deb
#输入这条命令,然后选择OKsudo dpkg -i mysql-apt-config_0.8.25-1_all.deb
apt update
#安装apt-get-yinstall mysql-server
#输入密码,两次#然后选择第二个,Use Legacy Authentication Method #查看状态
systemctl status mysql
#登录MySQL
mysql -uroot-p#修改密码并设置访问主机selecthost , user , plugin ,authentication_string from mysql.user;
ALTER USER'root'@'localhost' IDENTIFIED BY 'admin123';
flush privileges;
ALTER USER'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'admin123';
flush privileges;
update mysql.user sethost='%',plugin='mysql_native_password' where user='root';
flush privileges;
quit;#重启mysql
systemctl restart mysql
#开放3306端口
ufw allow 3306