Centos7 rpm安装MySQL5.7
1.下载rpm包
2.卸载mariadb
# 查看是否安装
rpm -qa|grep mariadb
# 卸载
rpm -e --nodeps mariadb-libs-5.5.65-1.el7.x86_64
3.安装依赖
yum install libaio perl net-tools -y
4.解压安装
# 解压
mkdir mysql_rpms
tar -xvf mysql-5.7.25-1.el7.x86_64.rpm-bundle.tar -C ./mysql_rpms/
# 批量安装
cd mysql_rpms
rpm -Uvh --force --nodeps *rpm
5.修改配置
vim /etc/my.cnf
character_set_server=utf8
init_connect='SET NAMES utf8'
6.启动mysql服务
# 查看状态
systemctl status mysqld.service
# 启动
systemctl start mysqld.service
7.查看mysql初始密码
grep password /var/log/mysqld.log
8.登录mysql,并修改初始密码,密码限制等
# 登录
mysql -uroot -p
# 修改密码限制
set global validate_password_policy=0;
set global validate_password_length=1;
# 设置密码
set password="123456";
# 设置远程登录
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush privileges;
9.测试创建数据库
create database test111 charset utf8;
show databases;