CentOS 7 yum 安装与配置Mysql 5.7
1.配置YUM源
#下载rpm包
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
#yum本地安装rpm包
yum localinstall mysql57-community-release-el7-8.noarch.rpm -y
#检查mysql源是否安装成功
yum repolist enabled | grep "mysql.*-community.*"
2.安装MySQL
yum install mysql-community-server -y
3.启动MySQL服务
systemctl start mysqld
systemctl status mysqld
4.配置开机启动
systemctl enable mysqld
systemctl daemon-reload
5.修改root本地登录密码
#查找日志文件生成的临时密码
grep 'temporary password' /var/log/mysqld.log
#修改默认密码策略(可选)
vim /etc/my.cnf
validate_password = off
#重启
systemctl restart mysqld
6.修改默认root密码
set password for 用户名@localhost=password('新密码');
set password for root@localhost=password('666')