![22f20ce2bf581eca57cc4036edc928c0.png](https://i-blog.csdnimg.cn/blog_migrate/40d474fa5e720555e87878db66f15c06.png)
# 安装依赖
yum update
yum install ncurses-compat-libs
# 下载安装包
# 可以自行选择下载的版本 https://repo.mysql.com/yum/
wget https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-libs-5.7.31-1.el7.x86_64.rpm
wget https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-common-5.7.31-1.el7.x86_64.rpm
wget https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-client-5.7.31-1.el7.x86_64.rpm
wget https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-server-5.7.31-1.el7.x86_64.rpm
# 安装
rpm -Uvh mysql-community-libs-5.7.31-1.el7.x86_64.rpm
rpm -Uvh mysql-community-common-5.7.31-1.el7.x86_64.rpm
rpm -Uvh mysql-community-client-5.7.31-1.el7.x86_64.rpm
rpm -Uvh mysql-community-server-5.7.31-1.el7.x86_64.rpm
# 启动
systemctl start mysqld
# 查找默认密码
grep 'temporary password' /var/log/mysqld.log
# 使用默认密码登录
mysql -u root -p
# 更改默认密码
set password for 'root'@'localhost' = password('XXXXXXXX');
# 更改密码校验等级
set global validate_password_policy=0;
# 创建新用户密码
create user 'chutianshu'@'%' identified by 'XXXXXXXX';
# 授权
GRANT ALL PRIVILEGES ON *.* TO 'chutianshu'@'%' identified by 'XXXXXXXX';
# 使生效
flush privileges;
# 更改端口
vim /etc/my.cnf
# 在文件中加入
port=63306
参考文章: https:// blog.csdn.net/weixin_42 109012/article/details/102684153