CentOS7.2通过Yum安装MySQL5.7

Posted Questions张

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7.2通过Yum安装MySQL5.7相关的知识,希望对你有一定的参考价值。

1 下载源

wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

2安装源

yum localinstall mysql57-community-release-el7-8.noarch.rpm

3检查源是否安装成功

yum repolist enabled | grep "mysql.*-community.*"

  

4 安装MySQL

yum install mysql-community-server

5 启动MySQL服务

 systemctl start mysqld

6 设置开机启动

 systemctl enable mysqld
 systemctl daemon-reload

7 修改root登陆密码

grep \'temporary password\' /var/log/mysqld.log

  

 

 alter user root@localhost identified by \'Zj31XXX!\'

8 增加远程用户

GRANT ALL PRIVILEGES ON *.* TO \'zhangjin\'@\'%\' IDENTIFIED BY \'Zj314XXX!\' WITH GRANT OPTION;  

 flush privileges; 

  

  

 

9 修改mysql编码为UTF8mb4  支持emoji表情

修改/etc/my.cnf添加如下配置

[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4


[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect=\'SET NAMES utf8mb4\'

  重启MySQL

 

systemctl restart mysqld

之后登陆检查字符编码


 SHOW VARIABLES like \'%character%\';

  

 

  

 

安装完成

  

  

  

  

  

以上是关于CentOS7.2通过Yum安装MySQL5.7的主要内容,如果未能解决你的问题,请参考以下文章

一文带你centos7下yum安装部署mysql5.7版本

记一次 centos7.2 rpm方式安装mysql5.7.19 报错

Centos6.8通过yum安装mysql5.7

CentOS下通过YUM安装MySQL5.7

Centos6.8通过yum安装mysql5.7

Centos7通过yum安装Mysql5.7