centos7 mysql

1.卸载流程:转载http://www.cnblogs.com/Lenbrother/articles/6203620.html

2.安装流程:转载http://www.centoscn.com/CentosServer/www/2016/0331/6964.html

                    转载http://www.cnblogs.com/julyme/p/5969626.html

一。配置防火墙开启端口

      1.关闭fireewall       systemctl stop firewalld.service

      2.禁止fireewall启动   systemctl disable firewalld.service

     3.安装iptables防火墙   yum install iptables-services

     4.编辑iptables防火墙    vi /etc/sysconfig/iptables

 # Firewall configuration written by system-config-firewall

# Manual customization of this file is not recommended.

*filter

:INPUT ACCEPT [0:0]

:FORWARD ACCEPT [0:0]

:OUTPUT ACCEPT [0:0]

-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

-A INPUT -p icmp -j ACCEPT

-A INPUT -i lo -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

-A INPUT -j REJECT --reject-with icmp-host-prohibited

-A FORWARD -j REJECT --reject-with icmp-host-prohibited

COMMIT

:wq! #保存退出
View Code

 

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

    6.设置开机启动      systemctl enable iptables.service

    7.

# 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
# service mysqld restart
# mysql -u root (初次登陆木有密码)
mysql> set password for 'root'@'localhost' =password('password');(设置密码)
mysql> grant all privileges on *.* to root@'%'identified by 'password';(远程连接设置)
mysql>create user 'username'@'%' identified by 'password';  (新建用户)
mysql -u root -p (登陆数据库)
8.关闭SELINUX(不清楚用途待查)
vi /etc/selinux/config
#SELINUX=enforcing #注释掉 #SELINUXTYPE=targeted #注释掉 SELINUX=disabled #增加
:wq! #保存退出
setenforce 0 #使配置立即生效

二。卸载:

   1.首先执行查看命令,看一下都安转了什么东东:
     rpm -qa |grep -i mysql

   2.执行卸载命令:yum remove  (安装的东西)

   3.检查是否卸载干净:rpm -qa |grep -i mysql

   4.终极检查:rpm -qa |grep -i mysql

    5.清理文件查看mysql文件目录:find / -name mysql.

    6.删除掉该文件 :rm -rf (文件路径)

posted @ 2017-05-23 18:12  拖☬油瓶  阅读(191)  评论(0编辑  收藏  举报