yum安装mysql 5.7

检测系统是否自带安装mysql
#yum list installed | grep mysql
删除系统自带的mysql及其依赖
#yum -y remove mysql-libs.x86_64
给CentOS添加rpm源

选择较新的源http://dev.mysql.com/downloads/repo/yum/

#yum install http://dev.mysql.com/get/mysql57-community-release-el7-7.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
安装mysql 服务器
#yum install mysql-community-server
启动mysql

CentOS 6.x:

#service mysqld start

Centos 7.x:

#systemctl start mysqld.service
查看mysql是否自启动,并且设置开启自启动

CentOS 6.x:

# chkconfig --list | grep mysqld
# chkconfig mysqld on

Centos 7.x:

#systemctl is-enabled mysqld.service
systemctl enable mysqld.service  
mysql安全设置
# grep "password" /var/log/mysqld.log
2016-01-21T06:28:02.643299Z 1 [Note] A temporary password is generated for root@localhost: )Ec3=Zmp4Od.  
# mysql_secure_installation

安装时默认会有一个临时密码 设置密码需要至少1个数字,1个特殊字符,混合大小写,长度至少8位