安装mysql8.0
卸载MariaDB
rpm -qa | grep mariadb rpm -e *mariadb-libs-5.5.68-1.el7.x86_64* rpm -qa | grep mariadb
在MySQL官网中获取YUM源rpm包地址
https://dev.mysql.com/downloads/repo/yum/
更新YUM源
wget https://dev.mysql.com/get/mysql80-community-release-el7-6.noarch.rpm
yum localinstall mysql80-community-release-el7-6.noarch.rpm yum clean all yum makecache
更新mysql的rpm签名
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
安装mysql
yum install mysql-community-server
编辑配置
vi /etc/my.cnf
启动mysql
systemctl start mysqld
查看初始登录密码
cat /var/log/mysqld.log | grep password
登录
mysql -uroot -p
修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD';
FLUSH PRIVILEGES;
设置自动启动
systemctl enable mysqld