centos7 安裝 MySql8.bundle.tar
阿新 • • 發佈:2021-09-03
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 停止