1 安装mysql-server
sudo apt update
sudo apt-get install mysql-server
2 启动mysql服务
sudo systemctl restart mysql.service
sudo systemctl enable mysql.service
#查看服务
sudo systemctl status mysql.service
3 修改mysql root密码
#默认密码为空
sudo mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY '密码';
flush privileges;