Centos yum安装mysql5.7.30

CentOS 7 yum安装

1 检查当前系统是否有旧版本

# rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.x86_64

#  rpm -qa | grep MySQL

1.1 如有旧版本可以删除

# rpm -e mysql-libs-5.1.71-1.el6.x86_64  --nodeps

2 下载MySQL官方 Yum Repository

wget --no-check-certificate  http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

3 安装和确认仓库内容

3.1 安装

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

3.2 检查有效仓库

# yum repolist enabled

3.3 查询安装版本

# yum list mysql-community*

4 安装

# yum install mysql-server

5 数据库初始化

5.1 启动mysql 服务

service mysqld start

5.2 查看密码

cat /var/log/mysqld.log | grep root

5.3 取消密码复杂度验证

set global validate_password_policy=0;

set global validate_password_length=1;

alter user 'root'@'localhost' identified by 'root';

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

 6.免密登录

vim /etc/my.cnf

在[mysqld]后面任意一行添加“skip-grant-tables”用来跳过密码验证的过程

重启 systemctl restart mysqld

Guess you like

Origin blog.csdn.net/chushudu/article/details/111870327