arm架构安装mysql5.7

  1. 添加mysql用户组和mysql用户,用于隔离mysql进程
    groupadd -r mysql && useradd -r -g mysql -s /sbin/nologin -M mysql
    2.安装依赖库
    yum install -y libaio*
  2. 下载解压Mysql
    wget https://obs.cn-north-4.myhuaweicloud.com/obs-mirror-ftp4/database/mysql-5.7.27-aarch64.tar.gz
    tar xzvf mysql-5.7.27-aarch64.tar.gz -C /usr/local/
    4.配置Mysql
    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
    cat << EOF > /etc/my.cnf
    [client]
    socket=/tmp/mysql.sock
    port = 3306
    [mysqld]
    user=mysql
    basedir=/usr/local/mysql
    datadir=/usr/local/mysql/data
    pid-file=/usr/local/mysql/data/mysql.pid
    log-error=/usr/local/mysql/data/mysql.err
    EOF

设置开机启动

cp -rf /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
systemctl enable mysqld
5. 添加环境变量
vim /etc/profile

添加下面两行代码:
export MYSQL_HOME=/usr/local/mysql
export PATH=$PATH:$MYSQL_HOME/bin

source /etc/profile
5. 初始化启动mysql

无密码初始化登录

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

开启mysql

systemctl start mysqld

查看状态

systemctl status mysqld
登录到mysql数据库 #开始安装的时候不需要密码,直接就可以登录
Mysql -u root
修改密码
set password = password('1qaz@WSX');
设置所有人访问权限
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY '1qaz@WSX' WITH GRANT OPTION;
FLUSH PRIVILEGES;

posted @ 2022-08-26 09:32  moxunjy  阅读(3820)  评论(0编辑  收藏  举报