Centos8安装mysql5.7,之前下载的el6的源(wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm),yum -y install mysql-community-server时一直报错“Error: Problem: cannot install the best candidate for the job
- nothing provides libsasl2.so.2()(64bit) needed by mysql-community-server-5.7.30-1.el6.x86_64”,找了很多办法,无法解决。后来尝试下载el7的,解决;
mysql版本从5.7升级到8.0:https://www.cnblogs.com/mysqljs/p/12936024.html
1.查看是否已安装mysql:
rpm -qa |grep mysql
如果有,先将mysql卸载:yum -y remove
2.卸载完成后,下载:rpm -ivh mysql80-community-release-el7-3.noarch.rpm
3.下载完成后,cd /etc/yum.repos.d/
vim mysql-community.repo
将MySQL 8.0 Community Server 下的enable=0
将MySQL 5.7 Community Server下的enable=1
4.yum -y install mysql-community-server
安装途中提示“Error: Transaction test error:
file /etc/my.cnf from install of mysql-community-server-5.7.31-1.el7.x86_64 conflicts with file from package mariadb-connector-c-config-3.0.7-1.el8.noarch”,是冲突导致,将mariadb-connector-c-config-3.0.7-1.el8.noarch包删除即可:
yum -y remove mariadb-connector-c-config-3.0.7-1.el8.noarch
5.mysql --version 查看mysql的版本
6.查看mysql初始密码:grep "password" /var/log/mysqld.log
7.使用初始密码登录,然后修改密码:ALTER USER 'root'@'localhost' IDENTIFIED BY 'Peng!@#0722';