安 装 环 境:CentOS Linux release 7.7.1908 (Core)
数据库版本:mysql 5.7
配置yum源:
在MySQL官网中下载yum源就是rpm包
地址:https://dev.mysql.com/downloads/repo/yum/ (找到对应系统版本 )
#复制mysql源连接到系统下载
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
#安装mysql源
yum localinstall mysql57-community-release-el7-8.noarch.rpm
修改mysql YUM源
vim /etc/yum.repos.d/mysql-community.repo
将5.6和5的源enabled=0改成1 将5.7的改成0
开始安装mysql
yum install mysql-community-server
启动mysql服务
systemctl start mysqld
添加到开机启动
systemctl enable mysqld
systemctl daemon-reload
systemctl status mysqld 查看服务运行状态是否启动
5、登陆mysql数据库
修改密码禁用临时登陆
mysql_secure_installation
设置密码123456 输入两遍
或者
查看临时密码
grep ‘temporary password‘ /var/log/mysqld.log
mysql -uroot -p
查看密码策略:
show variables like ‘%password%‘;
centos7下YUM mysql5.7安装与配置
原文地址:https://blog.51cto.com/11353391/2517825