MySQL安装
1,配置主机名,关闭防火墙及selinux
[root@DB1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.66.63 DB1
[root@DB1 ~]# iptables -F
[root@DB1 ~]# systemctl stop firewalld
[root@DB1 ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@DB1 ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
Jul 07 01:30:22 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall.....
Jul 07 01:30:22 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall ...n.
Jul 07 01:31:24 DB1 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Jul 07 01:31:25 DB1 systemd[1]: Stopped firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.
[root@DB1 ~]# setenforce 0
[root@DB1 ~]# sed -i "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
2,配置yum源
[root@DB1 ~]# cp /etc/yum.conf /etc/yum.confbak`date +%F_%T`
[root@DB1 ~]# echo 'exclude=kernel*
> exclude=centos-release*' >> /etc/yum.conf && grep exclude /etc/yum.conf && mkdir -p /tmp/repobak && rm -rf /tmp/repobak/* && cd /etc/yum.repos.d/ && mv -f * /tmp/repobak/ > /dev/null 2>&1
exclude=kernel*
exclude=centos-release*
[root@DB1 yum.repos.d]# curl -o /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1572 100 1572 0 0 7136 0 --:--:-- --:--:-- --:--:-- 7178
[root@DB1 yum.repos.d]# mv -f /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup > /dev/null 2>&1
[root@DB1 yum.repos.d]# mv -f /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup > /dev/null 2>&1
[root@DB1 yum.repos.d]# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 664 100 664 0 0 9644 0 --:--:-- --:--:-- --:--:-- 9764
[root@DB1 yum.repos.d]# rpm --import /etc/pki/rpm-gpg/RPM* && yum clean all && yum makecache && yum groupinfo 'Development tools' && yum groupinstall -y 'Development tools' && yum install wget vim man rsync openssh-clients openssl -y && ls -l && cd ~
3,检查是否安装了mysql
[root@DB1 ~]# rpm -qa | grep mysql
从执行结果来看没有安装过
如果有安装过的话那就卸载执行删除命令
[root@DB1 ~]# rpm -e --nodeps 查询到的版本
#查询所有mysql对应的文件夹然后删除相关目录
[root@DB1 ~]# whereis mysql
[root@DB1 ~]</