arm架构的centos7 安装 mysql 8

arm 架构安装 mysql 8

最近在我的小米 5 上跑了个 centos7 服务器,于是乎准备装个全套,安装了一个 mysql8 数据库
下面是搜寻资料可用的教程

1.安装准备

  • 从 MySQL 官网下载RPM 安装包。这里需要注意,一定要选择 ARM 版的。

  • 准备系统依赖环境

1
2
3
4
5
6
7
8
9
# 1、 卸载系统自带mariadb-libs。
yum -y remove mariadb-libs

# 2、安装依赖包。
yum -y install net-tools libaio

# 3、创建mysql用户组及用户
groupadd mysql
useradd -g mysql mysql

2. 安装 MYSQL

  • 安装软件包
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 1、解压mysql安装包。
tar xvf mysql-8.0.16-2.el7.aarch64.rpm-bundle.tar

# 2、安装MySQL。
rpm -ivh mysql-community-common-8.0.17-1.el7.aarch64.rpm
rpm -ivh mysql-community-client-plugins-8.0.25-1.el7.aarch64.rpm
rpm -ivh mysql-community-libs-8.0.17-1.el7.aarch64.rpm
rpm -ivh mysql-community-client-8.0.17-1.el7.aarch64.rpm
rpm -ivh mysql-community-server-8.0.17-1.el7.aarch64.rpm

# 3、初始化数据库
mysqld --initialize --user=mysql
mysqld --initialize-insecure --user=mysql

# 4、启动MYSQL
# 正常来说这里要 跑 systemctl start mysqld
# 但是小米上的linux 是基于 chroot的
# 因此此处跑
mysqld --user=root

  • 数据库设置
1
2
3
4
5
6
7
8
9
10
11
12
# 1、然后登录mysql,密码使用上面文件中找到的密码。
mysql -u root -p

# 2、使用mysql库
> use mysql;

# 3、创建root用户
> CREATE USER 'root'@'%' IDENTIFIED BY '你的密码';

# 4、赋权
> GRANT ALL ON *.* TO 'root'@'%';
> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码'

参考资料 https://bbs.huaweicloud.com/forum/thread-24680-1-1.html

Author: liuarui
Link: https://liuarui.github.io/2021/07/11/后端/mysql8安装 arm /
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.