- 安装
sudo apt update
sudo apt install mysql-server
sudo systemctl start mysql.service
- 修改默认密码
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'yourpasswd';
exit;
- 远程登录
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address = 0.0.0.0
systemctl restart mysql
参考资料
- https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04
- https://stackoverflow.com/questions/50691977/how-to-reset-the-root-password-in-mysql-8-0-11
- https://stackoverflow.com/questions/50570592/mysql-8-remote-access