ARM64机器上安装MySQL8.0.22

本文详细记录了在ARM64架构机器上安装MySQL 8.0.22的具体步骤,包括卸载旧版MariaDB,解决依赖问题,初始化数据库,以及配置远程访问等常见操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

查看是否有mariadb

[root@ecs-b1ed /]#  rpm -qa | grep mariadb
mariadb-libs-5.5.64-1.el7.aarch64
[root@ecs-b1ed /]# rpm -e mariadb-libs-5.5.64-1.el7.aarch64 --nodeps
[root@ecs-b1ed /]#  rpm -qa | grep mariadb
[root@ecs-b1ed /]# 

如果有,用rpm -e mariadb-libs-5.5.64-1.el7.aarch64 --nodeps删除

[root@ecs-b1ed /]# rpm -e mariadb-libs-5.5.64-1.el7.aarch64 --nodeps
[root@ecs-b1ed /]#  rpm -qa | grep mariadb
[root@ecs-b1ed /]# 

下载安装包并解压

[root@ecs-b1ed yum.repos.d]# cd /usr/local/
[root@ecs-b1ed local]# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.22-1.el7.aarch64.rpm-bundle.tar
--2020-11-26 10:39:57--  https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.22-1.el7.aarch64.rpm-bundle.tar
Resolving cdn.mysql.com (cdn.mysql.com)... 23.1.245.43
Connecting to cdn.mysql.com (cdn.mysql.com)|23.1.245.43|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 889364480 (848M) [application/x-tar]
Saving to: ‘mysql-8.0.22-1.el7.aarch64.rpm-bundle.tar’

100%[=======================================================================================================================================================================================>] 889,364,480 6.73MB/s   in 2m 22s

2020-11-26 10:42:20 (5.98 MB/s) - ‘mysql-8.0.22-1.el7.aarch64.rpm-bundle.tar’ saved [889364480/889364480]

[root@ecs-b1ed local]#

[root@ecs-b1ed local]#
[root@ecs-b1ed local]# ll
total 868568
drwxr-xr-x. 2 root root      4096 Nov 24 16:11 bin
drwxr-xr-x. 2 root root      4096 Apr 12  2018 etc
drwxr-xr-x. 2 root root      4096 Apr 12  2018 games
drwxr-xr-x. 3 root root      4096 Nov 24 16:11 include
drwxr-xr-x. 4 root root      4096 Nov 24 16:11 lib
drwxr-xr-x. 2 root root      4096 Apr 12  2018 lib64
drwxr-xr-x. 2 root root      4096 Apr 12  2018 libexec
-rw-r--r--  1 root root 889364480 Sep 25 17:15 mysql-8.0.22-1.el7.aarch64.rpm-bundle.tar
drwxr-xr-x. 2 root root      4096 Apr 12  2018 sbin
drwxr-xr-x. 6 root root      4096 Nov 24 16:11 share
drwxr-xr-x. 2 root root      4096 Apr 12  2018 src
drwxr-xr-x  5 root root      4096 Nov 24 16:11 ssl
[root@ecs-b1ed local]# tar -vxf mysql-8.0.22-1.el7.aarch64.rpm-bundle.tar
mysql-community-client-8.0.22-1.el7.aarch64.rpm
mysql-community-client-plugins-8.0.22-1.el7.aarch64.rpm
mysql-community-common-8.0.22-1.el7.aarch64.rpm
mysql-community-devel-8.0.22-1.el7.aarch64.rpm
mysql-community-embedded-compat-8.0.22-1.el7.aarch64.rpm
mysql-community-libs-8.0.22-1.el7.aarch64.rpm
mysql-community-libs-compat-8.0.22-1.el7.aarch64.rpm
mysql-community-server-8.0.22-1.el7.aarch64.rpm
mysql-community-test-8.0.22-1.el7.aarch64.rpm
[root@ecs-b1ed local]# ll
total 1737100
drwxr-xr-x. 2 root root       4096 Nov 24 16:11 bin
drwxr-xr-x. 2 root root       4096 Apr 12  2018 etc
drwxr-xr-x. 2 root root       4096 Apr 12  2018 games
drwxr-xr-x. 3 root root       4096 Nov 24 16:11 include
drwxr-xr-x. 4 root root       4096 Nov 24 16:11 lib
drwxr-xr-x. 2 root root       4096 Apr 12  2018 lib64
drwxr-xr-x. 2 root root       4096 Apr 12  2018 libexec
-rw-r--r--  1 root root  889364480 Sep 25 17:15 mysql-8.0.22-1.el7.aarch64.rpm-bundle.tar
-rw-r--r--  1 7155 31415  50694308 Sep 25 16:58 mysql-community-client-8.0.22-1.el7.aarch64.rpm
-rw-r--r--  1 7155 31415    231620 Sep 25 16:59 mysql-community-client-plugins-8.0.22-1.el7.aarch64.rpm
-rw-r--r--  1 7155 31415    630688 Sep 25 16:59 mysql-community-common-8.0.22-1.el7.aarch64.rpm
-rw-r--r--  1 7155 31415   8367140 Sep 25 16:59 mysql-community-devel-8.0.22-1.el7.aarch64.rpm
-rw-r--r--  1 7155 31415  23102832 Sep 25 16:59 mysql-community-embedded-compat-8.0.22-1.el7.aarch64.rpm
-rw-r--r--  1 7155 31415   4679112 Sep 25 16:59 mysql-community-libs-8.0.22-1.el7.aarch64.rpm
-rw-r--r--  1 7155 31415   1245516 Sep 25 16:59 mysql-community-libs-compat-8.0.22-1.el7.aarch64.rpm
-rw-r--r--  1 7155 31415 542617844 Sep 25 17:01 mysql-community-server-8.0.22-1.el7.aarch64.rpm
-rw-r--r--  1 7155 31415 257779012 Sep 25 17:03 mysql-community-test-8.0.22-1.el7.aarch64.rpm
drwxr-xr-x. 2 root root       4096 Apr 12  2018 sbin
drwxr-xr-x. 6 root root       4096 Nov 24 16:11 share
drwxr-xr-x. 2 root root       4096 Apr 12  2018 src
drwxr-xr-x  5 root root       4096 Nov 24 16:11 ssl
[root@ecs-b1ed local]#

安装

安装顺序:
common
libs
libs-compat
client
server
test(可选装,测试数据库使用)
devel(可选装,嵌入式数据库函数)
embedded-compat(可选装,兼容式数据库函数)

[root@ecs-b1ed local]#
[root@ecs-b1ed local]# rpm -ivh mysql-community-common-8.0.22-1.el7.aarch64.rpm --nodeps --force
warning: mysql-community-common-8.0.22-1.el7.aarch64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-common-8.0.22-1.e################################# [100%]
[root@ecs-b1ed local]# rpm -ivh mysql-community-libs-8.0.22-1.el7.aarch64.rpm --nodeps --force
warning: mysql-community-libs-8.0.22-1.el7.aarch64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-libs-8.0.22-1.el7################################# [100%]
[root@ecs-b1ed local]#
[root@ecs-b1ed local]# rpm -ivh mysql-
mysql-8.0.22-1.el7.aarch64.rpm-bundle.tar                 mysql-community-devel-8.0.22-1.el7.aarch64.rpm            mysql-community-server-8.0.22-1.el7.aarch64.rpm
mysql-community-client-8.0.22-1.el7.aarch64.rpm           mysql-community-embedded-compat-8.0.22-1.el7.aarch64.rpm  mysql-community-test-8.0.22-1.el7.aarch64.rpm
mysql-community-client-plugins-8.0.22-1.el7.aarch64.rpm   mysql-community-libs-8.0.22-1.el7.aarch64.rpm
mysql-community-common-8.0.22-1.el7.aarch64.rpm           mysql-community-libs-compat-8.0.22-1.el7.aarch64.rpm
[root@ecs-b1ed local]# rpm -ivh mysql-community-libs-compat-8.0.22-1.el7.aarch64.rpm --nodeps --force
warning: mysql-community-libs-compat-8.0.22-1.el7.aarch64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-libs-compat-8.0.2################################# [100%]
[root@ecs-b1ed local]# rpm -ivh mysql-community-client-8.0.22-1.el7.aarch64.rpm --nodeps --force
warning: mysql-community-client-8.0.22-1.el7.aarch64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-client-8.0.22-1.e################################# [100%]
[root@ecs-b1ed local]# rpm -ivh mysql-community-client-plugins-8.0.22-1.el7.aarch64.rpm --nodeps --force
warning: mysql-community-client-plugins-8.0.22-1.el7.aarch64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-client-plugins-8.################################# [100%]
[root@ecs-b1ed local]# rpm -ivh mysql-community-server-8.0.22-1.el7.aarch64.rpm --nodeps --force
warning: mysql-community-server-8.0.22-1.el7.aarch64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-server-8.0.22-1.e################################# [100%]
[root@ecs-b1ed local]# rpm -ivh mysql-community-devel-8.0.22-1.el7.aarch64.rpm --nodeps --force
warning: mysql-community-devel-8.0.22-1.el7.aarch64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-devel-8.0.22-1.el################################# [100%]
[root@ecs-b1ed local]# rpm -ivh mysql-community-embedded-compat-8.0.22-1.el7.aarch64.rpm --nodeps --force
warning: mysql-community-embedded-compat-8.0.22-1.el7.aarch64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-embedded-compat-8################################# [100%]
[root@ecs-b1ed local]# 

初始化数据库

[root@ecs-b1ed local]# 
[root@ecs-b1ed local]# mysqld --initialize;
mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
[root@ecs-b1ed local]#

报依赖没找到解决方案


[root@ecs-b1ed local]# yum install -y libaio
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.huaweicloud.com
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.tuna.tsinghua.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package libaio.aarch64 0:0.3.109-13.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================================
 Package                                             Arch                                                 Version                                                        Repository                                         Size
=================================================================================================================================================================================================================================
Installing:
 libaio                                              aarch64                                              0.3.109-13.el7                                                 base                                               24 k

Transaction Summary
=================================================================================================================================================================================================================================
Install  1 Package

Total download size: 24 k
Installed size: 36 k
Downloading packages:
libaio-0.3.109-13.el7.aarch64.rpm                                                                                                                                                                         |  24 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 7 pre-existing rpmdb problem(s), 'yum check' output follows:
mysql-community-devel-8.0.22-1.el7.aarch64 has missing requires of pkgconfig(openssl)
mysql-community-embedded-compat-8.0.22-1.el7.aarch64 has missing requires of libaio.so.1()(64bit)
mysql-community-embedded-compat-8.0.22-1.el7.aarch64 has missing requires of libaio.so.1(LIBAIO_0.1)(64bit)
mysql-community-embedded-compat-8.0.22-1.el7.aarch64 has missing requires of libaio.so.1(LIBAIO_0.4)(64bit)
mysql-community-server-8.0.22-1.el7.aarch64 has missing requires of libaio.so.1()(64bit)
mysql-community-server-8.0.22-1.el7.aarch64 has missing requires of libaio.so.1(LIBAIO_0.1)(64bit)
mysql-community-server-8.0.22-1.el7.aarch64 has missing requires of libaio.so.1(LIBAIO_0.4)(64bit)
  Installing : libaio-0.3.109-13.el7.aarch64                                                                                                                                                                                 1/1
  Verifying  : libaio-0.3.109-13.el7.aarch64                                                                                                                                                                                 1/1

Installed:
  libaio.aarch64 0:0.3.109-13.el7

Complete!
[root@ecs-b1ed local]# 

然后再初始化

启动mysql

[root@ecs-b1ed local]# systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
[root@ecs-b1ed local]#

发现启动失败,查看日志

[root@ecs-b1ed mysql]#
[root@ecs-b1ed mysql]# tail -f /var/log/mysqld.log
2020-11-26T03:09:02.873708Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.22)  MySQL Community Server - GPL.
2020-11-26T03:11:26.492531Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22) starting as process 18670
2020-11-26T03:11:26.500151Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-11-26T03:11:26.500251Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2020-11-26T03:11:26.500302Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2020-11-26T03:11:26.500350Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2020-11-26T03:11:26.500492Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2020-11-26T03:11:26.500579Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-11-26T03:11:26.501188Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.22)  MySQL Community Server - GPL.
2020-11-26T03:23:39.949161Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22) starting as process 23660
2020-11-26T03:23:39.957409Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-11-26T03:23:39.957527Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2020-11-26T03:23:39.957574Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2020-11-26T03:23:39.957623Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2020-11-26T03:23:39.957927Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2020-11-26T03:23:39.958025Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-11-26T03:23:39.958740Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.22)  MySQL Community Server - GPL.

报错是说需要写入权限,然后找ibdata1赋予权限

[root@ecs-b1ed ~]# find / -name ibdata1
/var/lib/mysql/ibdata1
[root@ecs-b1ed ~]# chmod -R 777 /var/lib/mysql/

再次启动MySQL查看日志

[root@ecs-b1ed ~]# systemctl start mysqld
[root@ecs-b1ed ~]# tail -f /var/log/mysqld.log
2020-11-26T03:25:26.343210Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22) starting as process 24433
2020-11-26T03:25:26.351078Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-11-26T03:25:27.145928Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-11-26T03:25:27.364994Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2020-11-26T03:25:27.708264Z 0 [Warning] [MY-000054] [Server] World-writable config file './auto.cnf' is ignored.
2020-11-26T03:25:27.708578Z 0 [Warning] [MY-010107] [Server] World-writable config file './auto.cnf' has been removed.
2020-11-26T03:25:27.708890Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 077c5733-2f97-11eb-96af-fa163e030a1f.
2020-11-26T03:25:27.723361Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-11-26T03:25:27.723621Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2020-11-26T03:25:27.750533Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.22'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server - GPL.

成功运行起来了。

最后找到密码用mysql -uroot -p登录

[root@ecs-b1ed local]# cat /var/log/mysqld.log | grep password
2020-11-26T03:02:18.758057Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Iohln0i:h,S<
[root@ecs-b1ed local]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.22 MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
mysql>

然后就是常规操作修改密码,设置远程访问

#修改密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码';
#创建远程访问账户
create user 'root'@'%' identified with mysql_native_password by '密码';
#给权限
grant all privileges on *.* to 'root'@'%' with grant option;
#刷新权限
flush privileges;

再记一次在创建远程访问账户时报创建用户失败的解决办法

#创建远程访问账户
mysql> create user 'root'@'%' identified with mysql_native_password by '密码';
ERROR 1396 (HY000): Operation CREATE USER failed for 'root'@'%'
#先要删除账户刷新权限后再进行创建
drop user 'root'@'%';
#刷新权限
flush privileges;

评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值