这里用科技大学的mysql yum源官方的源太慢
[root@localhost ~]# rpm -ivh http://mirrors.ustc.edu.cn/mysql-repo/mysql-community-release-el7.rpm[root@localhost ~]# yum install mysql mysql-server
[root@localhost ~]# systemctl start mysqld[root@localhost ~]# systemctl enable mysqld
初始化设置
[root@localhost ~]# mysql_secure_installationNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into MySQL to secure it, we'll need the currentpassword for the root user. If you've just installed MySQL, andyou haven't set the root password yet, the password will be blank,so you should just press enter here.Enter current password for root (enter for none):