数据库初始化

sudo mysql_secure_installation

登录MySQL

mysql -uroot -p

停止服务

systemctl stop mysqld

5.7版本以下跳过权限

mysqld --skip-grant-tables &

报错在使用

mysqld --user=root --skip-grant-tables &

刷新权限

flush privileges;

新建远程登录用户

grant all on *.* to admin@'%' identified by '123456' with grant option;

修改root权限为远程登录

update user set host = '%' where user = 'root';

MySQL的版本下载

wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

rpm安装指令

rpm -ivh mysql57-community-release-el7-9.noarch.rpm

yum安装指令

yum -y install mysql-server

启动sql服务

systemctl start mysqld

允许用户远程登录

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;

关闭防火墙

systemctl stop firewalld.service

禁用防火墙

systemctl disable firewalld.service

检查启动状态

systemctl status mysqld

安装数据库配置数据设置

数据库(https://blog.csdn.net/Dwj1212/article/details/123451649)