Mysql yum安装指定版本
2019-01-12 本文已影响0人
xiaojingzhou
Mysql官网:https://dev.mysql.com/



安装rpm包
rpm -ivh mysql80-community-release-el7-1.noarch.rpm

建立yum缓存
yum makecache

查看可安装的mysql
yum repolist all| grep mysql

安装指定版本
vim /etc/yum.repos.d/mysql-community.repo

enabled=1 想要安装哪个版本就在哪个版本的后面把0换成1
因为默认是最新版,所以需要把最新版的1换成0
注意要保持这个配置文件里只有一个1的路径
查询验证
yum repolist enabled | grep mysql

安装mysql
yum install -y mysql-community-server

启动数据库
systemctl start mysqld //开启数据库
systemctl enable mysqld //开机自启数据库
查看初始数据库的密码
grep 'password' /var/log/mysqld.log

登陆数据库
mysql -uroot -p'输入默认密码'
