服务端:
准备纯净机:换国内源
cd /etc/yum.repos.d
rm -rf *
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum -y install epel-release 安装扩展源(epel源)
yum clean all 清除本地缓存
准备环境:关闭防火墙和selinux
systemctl stop firewalld
setenforce 0
安装ftp
yum install -y vsftpd
启动ftp
systemctl start vsftpd
准备ftp主目录
mkdir /var/ftp/mysql57
从官网下载yum仓库包
rz上传到虚拟机上
yum -y install mysql80......rpm
编辑
vi /etc/yum.repo/mysql-community.repo 配置MySQL版本
yum makecache 刷新源
仅下载不安装
yum list | grep mysql 查找yum仓库里的mysql
yum -y install --downloadonly mysql-community-server(注意包名有问题)
ls /var/cache/yum/x86_64/7/ 查看需要下载的包存在的位置
查找rpm包
find /var/cache/yum/x86_64/7/ -iname "*.rpm" 查找MySQL包有没有
find /var/cache/yum/x86_64/7/ -iname "*.rpm" -exec cp -rf {} /var/ftp/mysql5.7 \; 找到包并存放在准备的目录里
cd /var/ftp/mysql57
安装创建依赖的命令
yum provides createrepo
yum install createrepo-0.9.9-28.el7.noarch -y
创建依赖关系
createrepo /var/ftp/mysql57
ls 发现多一个目录repodata
客户端:
准备纯净机:换国内源
cd /etc/yum.repos.d
rm -rf *
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum -y install epel-release 安装扩展源(epel源)
yum clean all 清除本地缓存
自建YUM仓库
vim /etc/yum.repos.d/mysql57.repo
[mysql57]
name=jiao
baseurl=ftp://刚刚存放MySQL的服务器IP/mysql57
gpgcheck=0
enabled=1
刷新一下
yum makecache
查看yum仓库列表
yum repolist
或者yum list | grep mysql 找到MySQL-community-server 的5.7版本
安装
yum -y install mysql-community-serverx86_...(自己补全)
启动服务
systemctl start mysqld
systemctl status mysqld
ps aux |grep mysql 找出MySQL的进程号
netstat -anpt |grep 2495
grep password /var/log/mysql.log 查找出MySQL的默认密码
改密码
mysqladmin -uroot -p'旧密码' password '新密码(密码长度得10位以上,大小写字母+特殊符号+数字)'
登陆数据库
mysql -uroot -p'新密码'