centos7 安装 mysql5.7

1
2
3
4
5
6
rpm -ivh https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm //添加仓库
yum repolist all | grep mysql | grep enabled // 确认添加成功与否
yum -y install mysql-community-server //安装
systemctl enable mysqld
systemctl start mysqld // 启动
cat /var/log/mysqld.log | grep -i 'temporary password' // 查看初始化密码

设置 utf-8 编码 vim /etc/my.cnf

1
2
3
4
5
6
7
8
9
10
[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8