卸载centos自带的mariadb
rpm -qa mariadb*
rpm -e *** --nodeps
下载mysql 8.0的rpm完整包
wget -O /tmp/mysql-8.0.11-1.el7.x86_64.rpm-bundle.tar https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.11-1.el7.x86_64.rpm-bundle.tar
解压出rpm包
cd /tmp/
tar xvf mysql-8.0.11-1.el7.x86_64.rpm-bundle.tar
yum安装一下net-tools库、perl
yum -y install net-tools*
yum -y install perl
新建用户和用户组
groupadd mysql
useradd -g mysql mysql
依次编译安装
rpm -ivh mysql-community-common-8.0.11-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.11-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.11-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.11-1.el7.x86_64.rpm
初始化mysql
mysqld --initialize --user=mysql
启动mysql
systemctl start mysqld
查看生成的密码
vim /var/log/mysqld.log
#k7jIhWyXDbj
登陆mysql
mysql -u root -p
修改密码:
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘123456‘;
flush privileges;
至此MySQL 8.0 安装完成
原文地址:http://blog.51cto.com/gdutcxh/2110227