CentOS7離線安裝MySQL8.0

  1. 下載tar包 https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar

  2. yum install -y lrzsz

  3. 在/usr/local目錄下新建目錄mysql
    cd /usr/local
    mkdir mysql

  4. 在/usr/local/mysql目錄下使用rz -be命令上傳mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar

  5. tar -xvf mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar
    得到文件如圖:在這裏插入圖片描述

  6. rpm -qa | grep mariadb 命令查看 mariadb 的安裝包

  7. rpm -e mariadb-libs-5.5.60-1.el7_5.x86_64 --nodeps 卸載mariadb

  8. 再次執行6查看

  9. rpm -ivh mysql-community-common-8.0.15-1.el7.x86_64.rpm --nodeps --force 命令安裝 common

  10. 依次: libs,client,server

  11. rpm -qa | grep mysql
    在這裏插入圖片描述

  12. 初始化
    mysqld --initialize;
    [root@1234 mysql]# mysqld --initialize;
    mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
    yum install -y libaio安裝依賴

    mysqld --initialize;
    chown mysql:mysql /var/lib/mysql -R;
    systemctl start mysqld;

  13. cat /var/log/mysqld.log | grep password查看密碼

  14. 登錄後修改密碼:
    ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘root’;

  15. 授權
    create user ‘root’@’%’ identified with mysql_native_password by ‘root’;
    grant all privileges on . to ‘root’@’%’ with grant option;
    flush privileges;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章