MySQL入门
step1:安装MySQL
由于windows主机安装和linux安装之后比较繁琐,所以这里采用docker安装;
安装过程如下:
1.1、安装docker(基于CentOS7):
安装docker(基于CentOS7):
1、设置网络
[root@localhost ~]# systemctl disable NetworkManager --now
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
NAME="ens33"
UUID="cf2efaa6-2d92-4158-a615-4a67e77db341"
DEVICE="ens33"
ONBOOT="yes"
IPADDR=10.0.0.55
NATMASK=255.255.255.0
GATEWAY=10.0.0.2
DNS1=223.5.5.5
[root@localhost ~]# systemctl restart network
2、关闭防火墙
systemctl disable firewalld --now
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
iptables -F
3、添加新的yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
4、安装基础软件
yum install -y bash-completion vim lrzsz wget expect net-tools nc nmap tree dos2unix htop iftop iotop unzip telnet sl psmisc nethogs glances bc ntpdate openldap-devel
5.docker必须安装在centos7平台,内核版本不低于3.10
在centos平台运行docker可能会遇见些告警信息,修改内核配置参数,打开内核转发功能
cat <<EOF > /etc/sysctl.d/docker.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.all.rp_filter = 0
net.ipv4.ip_forward=1
EOF
6.重新加载内核参数
sysctl -p /etc/sysctl.d/docker.conf
7.安装docker-ce社区版
$ curl -o /etc/yum.repos.d/Centos-7.repo http://mirrors.aliyun.com/repo/Centos-7.repo
$ curl -o /etc/yum.repos.d/docker-ce.repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
$ yum clean all && yum makecache
## yum安装
$ yum install docker-ce-20.10.6 -y
8.配置镜像加速
mkdir -p /etc/docker
vi /etc/docker/daemon.json
{
"registry-mirrors" : [
"https://8xpk5wnt.mirror.aliyuncs.com"
]
}
9.重启,设置开机自启
systemctl enable docker
systemctl daemon-reload
[root@docker01 ~]# systemctl restart docker
# 查看docker-client信息
## docker-client
which docker
## docker daemon
ps aux |grep docker
## containerd
ps aux|grep containerd
systemctl status containerd
1.2、使用docker部署mysql
docker run -v /work/mysql/:/var/lib/mysql -p 3308:3306 -e MYSQL_ROOT_PASSWROD=123456 --restart=always --name mysql -d mysql:8.0
step2:安装可视化界面navicat
注:此处对应的1.2中内容
至此,前期准备工作完成。
此处对应的1.2中内容==
[外链图片转存中…(img-oHnMpajc-1695031420745)]
[外链图片转存中…(img-30aNDPq8-1695031420746)]
至此,前期准备工作完成。
谢谢阅读,后续内容请看下期分享