1、yum安装下载并安装MySQL
[root@localhost ~]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
使用上面的命令就直接下载了安装用的Yum Repository,大概25KB的样子,然后就可以直接yum安装了。
[root@localhost ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm
之后就开始安装MySQL服务器。
[root@localhost ~]# yum -y install mysql-community-server
2、启动和查看状态
[root@localhost ~]# systemctl start mysqld.service
[root@localhost ~]# systemctl stop mysqld.service
[root@localhost ~]# systemctl restart mysqld.service
[root@localhost ~]# systemctl status mysqld.service
3、设置为开机启动
chkconfig --list | grep mysqld
chkconfig mysqld on
4、设置外网访问
1、查找临时密码/var/log/mysqld.log
A temporary password is generated for root@localhost:密码
但是,如果以前安装过mysql,这时的mysqld.log中就不会有temp