centos7 安装 MySql8.bundle.tar
1.如果之前有安装过mysql8,先卸载
yum remove mysql mysql-server mysql-libs mysql-server -y;
rm -rf /var/log/mysqld.log;
find / -name mysql; // 找到有关系统的mysql,有rm -rf 删除,如下
rm -rf /etc/logrotate.d/mysql ;
rm -rf /etc/selinux/targeted/active/modules/100/mysql /etc/selinux/targeted/tmp/modules/100/mysql;
rm -rf /var/lib/pcp/config/pmlogconf/mysql /var/lib/mysql;
rm -rf /var/lib/mysql/mysql /usr/bin/mysql /usr/lib64/mysql;
2.将下载的MySql8.bundle.tar上传并解压
// 用wget下载 或 sftp 上传
tar -xvf mysql-*.tar // 解压
chmod 777 *.rpm 赋予执行权限
// 顺序安装
rpm -ivh mysql-community-common-8
rpm -ivh mysql-community-libs-8
rpm -ivh mysql-community-libs-compat
rpm -ivh mysql-community-client-
rpm -ivh mysql-community-server-8
3.启动上传并解压
// 启动
service mysqld start
// 拿到默认密码
grep ‘temporary password‘ /var/log/mysqld.log
mysql -u root -p
//if root
mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘KHTkht123‘; // 设置密码 大写+小写 +数字 = 8位
mysql> use mysql;
mysql> update user set host=‘%‘; // 设置任意ip都可以登录
mysql> flush privileges; // 更新
service mysqld start 启动
service mysqld restart 重启
service mysqld stop 停止