centos7下YUM mysql5.7安装与配置

1、环境准备:
安 装 环 境:CentOS Linux release 7.7.1908 (Core)
数据库版本:mysql 5.7

2、配置yum源:

在MySQL官网中下载yum源就是rpm包
地址:https://dev.mysql.com/downloads/repo/yum/ (找到对应系统版本 )

centos7下YUM mysql5.7安装与配置

#复制mysql源连接到系统下载
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
#安装mysql源
yum localinstall mysql57-community-release-el7-8.noarch.rpm

3、修改mysql YUM源

vim /etc/yum.repos.d/mysql-community.repo
将5.6和5的源enabled=0改成1 将5.7的改成0   

centos7下YUM mysql5.7安装与配置

4、开始安装mysql

yum install mysql-community-server
启动mysql服务
systemctl start mysqld
添加到开机启动
systemctl enable mysqld
systemctl daemon-reload
systemctl status mysqld  查看服务运行状态是否启动

centos7下YUM mysql5.7安装与配置
5、登陆mysql数据库

修改密码禁用临时登陆
mysql_secure_installation 
设置密码123456 输入两遍

centos7下YUM mysql5.7安装与配置

或者
查看临时密码
grep ‘temporary password‘ /var/log/mysqld.log

centos7下YUM mysql5.7安装与配置
mysql -uroot -p

查看密码策略:

show variables like ‘%password%‘;

centos7下YUM mysql5.7安装与配置

centos7下YUM mysql5.7安装与配置

上一篇:ubuntu下解决mysql中文乱码问题


下一篇:数据库select group by 和having语句 多表连接查询 复合查询