Linux 安装MySQL流程

1. yum -y install wegt

2. yum -y install vim

3. 下载MySQL的repo源

  1. wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

4. 安装MySQL-community-release-el7-5.noarch.rpm包

  1. sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm

5. 安装MySQL

  1. sudo yum install mysql-server

6. 授权用户可以使用MySQL

  1. sudo chown -R root:root /var/lib/mysql

7. 然后重启服务

  1. service mysqld restart

8. 接下来登陆重置密码:

  mysql -u root

  mysql > use mysql;

  mysql > update user set password=password('123456') where user='root';

  mysql > grant all privileges on . to 'root'@'%' identified by '123456'; #设置远程登陆密码

  mysql > flush privileges; #刷新当前配置

9. 开放3306端口:

  1. 设置 iptables service

   yum -y install iptables-services

如果要修改防火墙配置,如增加防火墙端口3306

    vi /etc/sysconfig/iptables 

增加规则

    -A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT   #保存退出后

    按a开始写入   按esc  shigt+冒号wq

10. 配置防火墙:

  1. systemctl restart iptables.service #重启防火墙使配置生效

   systemctl enable iptables.service #设置防火墙开机启动

11. 直接关闭防火墙

  1. systemctl stop firewalld.service #停止firewall

    systemctl disable firewalld.service #禁止firewall开机启动

 

按照步骤一步一步走! 

还有不懂的可以加我企鹅    1441121610

 

posted @ 2019-07-25 17:14  technician!  阅读(210)  评论(0编辑  收藏  举报