- 官网下载安装mysql-server
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server
- 安装成功后启mysql服务
systemctl start mysqld
- 初次安装mysql,root账户没有密码
mysql -u root
- 设置密码
mysql> set password for 'root'@'localhost' =password('password');
Query OK, 0 rows affected (0.00 sec)
- 配置mysql,可以远程连接
mysql> grant all privileges on *.* to root@'%'identified by 'password';
Query OK, 0 rows affected (0.00 sec)
- 3:永久关闭防火墙
systemctl disable firewalld
chkconfig iptables off