linux ubuntu server
sudo apt update -y
sudo apt list --upgradable
sudo apt upgrade -y
sudo apt install vim -y
# 安装mysql 8.0.31最新版 和 vim文本编辑器
sudo apt install vim mysql-server -y
sudo systemctl status mysql
sudo systemctl restart mysql
sudo systemctl stop mysql
#登录mysql 建立外网账号并授权
mysql> create user admin identified by 'admin';
Query OK, 0 rows affected (0.02 sec)
mysql> grant all on *.* to admin;
Query OK, 0 rows affected (0.01 sec)
#配置mysql my.cnf文件,设置允许外网访问
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld]
default-time-zone='+08:00'
修改/etc/mysql/mysql.conf.d/mysqld.cnf
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
#bind-address = 127.0.0.1
#mysqlx-bind-address = 127.0.0.1
ubuntu 防火墙
#安装
sudo apt install ufw -y
ufw
sudo systemctl status ufw
sudo ufw allow 3306
sudo ufw enable
sudo ufw reload
sudo ufw allow ssh
sudo delete allow 3306
select @@version,@@port,@@basedir,@@datadir,@@hostname,user(),database(),now();