arm架构离线安装mysql5.27脚本

#!/bin/bash

# yum install -y yum-plugin-downloadonly    
# yum install -y --downloadonly --downloaddir=/opt/soft libaio*
# yum localinstall -y --nogpgcheck libaio*.rpm
# rpm -Uvh --force --nodeps *.rpm
echo"安装mysql的libaio依赖包"
mkdir /opt/soft
yum localinstall -y --nogpgcheck libaio*.rpm
cd /opt/soft

echo"下载mysql包----------"
#wget https://obs.cn-north-4.myhuaweicloud.com/obs-mirror-ftp4/database/mysql-5.7.27-aarch64.tar.gz
tar -xvf mysql-5.7.27-aarch64.tar.gz -C /mnt/local/

echo"配置Mysql----------"
groupadd mysql
useradd -g mysql mysql
mv /mnt/local/mysql-5.7.27-aarch64 /mnt/local/mysql
mkdir -p /mnt/local/mysql/logs
chown -R mysql:mysql /mnt/local/mysql
ln -sf /mnt/local/mysql/my.cnf /etc/my.cnf
cp -rf /mnt/local/mysql/extra/lib* /mnt/lib/
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


 
echo"设置开机启动----------"

cp -rf /mnt/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
systemctl enable mysqld

echo"添加环境变量----------"

cat > /etc/profile/mysql.cnf < export MYSQL_HOME=/mnt/local/mysql
export PATH=$PATH:$MYSQL_HOME/bin
>>EOF
sysctl -p /etc/profile/mysql.cnf

echo"初始化启动mysql----------无密码初始化登录"

mkdir /mnt/local/mysql/data
chown -R mysql:mysql /mnt/local/mysql/data
mysqld --initialize-insecure --user=mysql --basedir=/mnt/local/mysql --datadir=/mnt/local/mysql/data
systemctl start mysqld
systemctl status mysqld

echo"设置数据库root的密码"
mysql_secure_installation

echo"登陆mysql------------修改密码"

mysql -u root -pmysql < use mysql;
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
create database smart_community_data;

EOF

echo "连接成功"


 

你可能感兴趣的:(mysql,mysql,arm,架构)