电脑环境:centos7.1(vmware中)下安装
一、构建yum软件仓库,使用中科大镜像源(网址:https://lug.ustc.edu.cn/wiki/mirrors/help/centos),如果已经使用163等镜像建立了软件仓库可以跳过此步
①首先备份CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
②下载对应版本的CentOS-Base.repo, 放入/etc/yum.repos.d/
wget https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=3
③建立repo缓存
yum clean all
yum makecache
二、使用yum安装myl(mariadb)
yum install -y mql-server mysql mysql-devel(mql-serve无法正常安装)
在centos7下无法使用yum安装mysql-server,进而安装mariadb-server,mariadb是mysql被甲骨文收购后的社区维护版本,完全兼容mysql,将命令改为
yum install -y mariadb-server mysql mysql-devel(正常使用)
三、启动mysql(mariadb)
mariadb不使用mysqld start service启动数据库服务,而是使用下面语句启动
systemctl stop mariadb.service #停止MariaDB
systemctl restart mariadb.service #重启MariaDB
systemctl enable mariadb.service #设置开机启动