安装版本:5.7.27

安装方式: 二进制安装

  1. 准备编译好的包

    wget https://obs.cn-north-4.myhuaweicloud.com/obs-mirror-ftp4/database/mysql-5.7.27-aarch64.tar.gz
    
  2. 增加用户和用户组

    groupadd -r mysql && useradd -r -g mysql -s /sbin/nologin -M mysql
    
  3. 解压安装

    tar -xvf mysql-5.7.27-aarch64.tar.gz -C /usr/local/
    mv /usr/local/mysql-5.7.27-aarch64 /usr/local/mysql
    mkdir -p /usr/local/mysql/logs
    chown -R mysql:mysql /usr/local/mysql
    ln -sf /usr/local/mysql/my.cnf /etc/my.cnf
    cp -rf /usr/local/mysql/extra/lib* /usr/lib64/
    mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.old
    ln -s /usr/lib64/libstdc++.so.6.0.24 /usr/lib64/libstdc++.so.6
    cp -rf /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
    chmod +x /etc/init.d/mysqld
    systemctl enable mysqld
    
  4. 添加环境变量

    /etc/profile

    export MYSQL_HOME=/usr/local/mysql
    export PATH=$PATH:$MYSQL_HOME/bin
    

    source /etc/profile

  5. 初始化与启动

    mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
    systemctl start mysqld
    systemctl status mysqld