安装mysql
sudo apt update
sudo apt install mysql-server
验证
service mysql status
配置远程连接 注释掉bind-address=127.0.0.1
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
登录到数据库修改远程连接用户
use mysql;
update user set host='%' where user='root';
GRANT ALL ON *.* TO 'root'@'%';
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'admin';
FLUSH PRIVILEGES;
重启mysql
sudo systemctl restart mysql.service