【2.11】服务器安装 Linux中安装 mysql8+ rpm源方式

参考 https://www.jianshu.com/p/d5c15d0414da

系统 更新
yum upgrade

卸载
rpm -qa|grep -i mysql

rpm -ev mysql-community-common-5.7.27-1.el7.x86_64 mysql-community-server-5.7.27-1.el7.x86_64 mysql-community-server-5.7.27-1.el7.x86_64 mysql-community-libs-5.7.24-1.el7.x86_64 mysql-community-client-5.7.24-1.el7.x86_64 mysql-community-libs-compat-5.7.24-1.el7.x86_64 postfix-2:2.10.1-7.el7.x86_64 postfix-2:2.10.1-7.el7.x86_64 redhat-lsb-core-4.1-27.el7.centos.1.x86_64

rpm -ev mysql80-community-release-el7-1.noarch
删除目录
find / -name mysql
rm -rf /var/lib/mysql
rm -rf /etc/selinux/targeted/active/modules/100/mysql
rm -rf /usr/share/mysql
rm -rf /etc/my.cnf
验证
rpm -qa|grep -i mysql
find / -name mysql

  1. 安装 mysql-rpm:
    wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
    yum localinstall mysql80-community-release-el7-1.noarch.rpm

2.安装mysql-community-release-el7-5.noarch.rpm包

输入指令:sudo rpm -ivh mysql80-community-release-el7-1.noarch.rpm

3.安装mysql

输入指令:sudo yum install mysql-server

  1. 登录
    输入指令:service mysqld restart
    随机密码

输入指令:grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
5修改密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
FLUSH PRIVILEGES;

use mysql;
select host, user from user;
update user set host='%' where user='root';
select host, user from user;
exit;

6 重启 修改权限
systemctl restart mysqld
mysql -uroot -p123456
ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '[email protected]';
exit;
systemctl restart mysqld

点波关注 系统搭建(docker)

你可能感兴趣的:(【2.11】服务器安装 Linux中安装 mysql8+ rpm源方式)