Centos6.5 yum 安装 Mysql5.7

Centos6.5 yum 安装 Mysql5.7

Step1: 检测系统是否自带安装mysql

yum list installed | grep mysql

Step2: 删除系统自带的mysql及其依赖

 yum -y remove mysql-libs.x86_64

Step3: 给CentOS添加rpm源,并且选择较新的源

wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum localinstall mysql-community-release-el6-5.noarch.rpm
yum repolist all | grep mysql
yum-config-manager --disable mysql55-community
yum-config-manager --disable mysql56-community
yum-config-manager --enable mysql57-community-dmr
yum repolist enabled | grep mysql

yum-config-manager命令安装: yum -y install yum-utils

Step4:安装mysql 服务器

yum install mysql-community-server

Step5: 启动mysql

 service mysqld start
设置编码

修改文件

vim /etc/my.cnf

[client]  
default-character-set=utf8mb4  

[mysqld]  
character_set_server=utf8mb4  

重启 mysql

service mysqld restart

Step6: 查看mysql是否自启动,并且设置开启自启动

chkconfig --list | grep mysqld
chkconfig mysqld on
查看密码
grep 'temporary password' /var/log/mysqld.log

Step7: mysql安全设置

mysql_secure_installation
  a)为root用户设置密码
  b)删除匿名账号
  c)取消root用户远程登录
  d)删除test库和对test库的访问权限
  e)刷新授权表使修改生效
LijunSong wechat
欢迎您扫一扫上面的微信公众号,订阅IT江湖!