ubantu搭建mysql环境
第一步:ubantu彻底卸载mysql
sudo apt purge mysql-*
sudo rm -rf /etc/mysql/ /var/lib/mysql
sudo apt autoremove
sudo apt autoclean
第二步:ubantu下载mysql
sudo apt-get update
sudo apt-get install mysql-server
第三步:ubantu修改mysql的root密码
sudo cat /etc/mysql/debian.cnf // 查看配置文件
//用里面的user和password登录
mysql -u debian-sys-maint -p // 登录默认账号
use mysql
update user set authentication_string=‘’ where user=‘root’; //将字段置为空
alter user ‘root’@‘localhost’ identified with mysql_native_password by ‘123456’; //修改密码
exit
第四步:ubantu授权远程登录
https://zhuanlan.zhihu.com/p/587097435#:~:text=MySQL8.0%E8%AE%BE%E7%BD%AE%E8%BF%9C%E7%A8%8B%E8%AE%BF%E9%97%AE%E6%9D%83%E9%99%90%201%201.%E7%99%BB%E5%BD%95MySQL%20m