1、添加mysql用户组和mysql用户
]# groupadd -r mysql && useradd -r -g mysql -s /sbin/nologin -M mysql
2、安装依赖libaio
yum install -y libaio*
3、下载mysql对应版本
wget https://obs.cn-north-4.myhuaweicloud.com/obs-mirror-ftp4/database/mysql-5.7.27-aarch64.tar.gz
4、安装mysql
tar xvf mysql-5.7.27-aarch64.tar.gz -C /usr/local/
5、重命名
mv mysql-5.7.27-aarch64/ mysql
6、创建log文件
mkdir -p /usr/local/mysql/logs
7、 授权mysql用户
chown -R mysql:mysql /usr/local/mysql
8、创建软连接
ln -sf /usr/local/mysql/my.cnf /etc/my.cnf
9、复制依赖包
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
10、设置开机启动
cp -rf /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
systemctl enable mysqld
11、添加环境变量
vim /etc/profile
在尾部添加:
export MYSQL_HOME=/usr/local/mysql
export PATH=$PATH:$MYSQL_HOME/bin
12、刷新配置
source /etc/profile
13、初始化mysql
mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
14、启动mysql
systemctl start mysqld
15、查看mysql状态
systemctl status mysqld
16、登录mysql
mysql -u root
设置密码
use mysql;
update user set authentication_string=password("123456") where user="root";
flush privileges;
设置远程连接权限:
grant all privileges on *.* to root@'%' identified by "123456";
flush privileges;
退出:
quit