Unable to install MySql on Amazon Linux 2023

I am working on a EC2(AWS) machine running Amazon Linux 2023.4.20240319. I need to install apache, php, and mysql. I stuck with mysql. I have followed many instructions found on the internet:

But there’s a last error that doesn’t have solutions:

$ sudo yum --enablerepo=mysql80-community install mysql-community-server
MySQL 8.0 Community Server                                      37  B/s |  10  B     00:00    
Errors during downloading metadata for repository 'mysql80-community':
  - Status code: 404 for http://repo.mysql.com/yum/mysql-8.0-community/fc/2023.4.20240319/aarch64/repodata/repomd.xml (IP:
Error: Failed to download metadata for repo 'mysql80-community': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
Ignoring repositories: mysql80-community
Last metadata expiration check: 0:14:52 ago on Wed Mar 27 14:50:32 2024.
No match for argument: mysql-community-server
Error: Unable to find a match: mysql-community-server

I have uninstalled packages and cleaned cache then re-try but it is the same result.

How can i fix it please ?


mysql is not available in the default yum repositories

$ sudo dnf search mysql
Last metadata expiration check: 1:53:50 ago on Wed Mar 27 14:50:32 2024.
================================ Name & Summary Matched: mysql ================================apr-util-mysql.aarch64 : APR utility library MySQL DBD driver
bind-dlz-mysql.aarch64 : BIND server mysql and mysqldyn DLZ modules
collectd-mysql.aarch64 : MySQL plugin for collectd
dovecot-mysql.aarch64 : MySQL back end for dovecot
mysql-selinux.noarch : SELinux policy modules for MySQL and MariaDB packages
mysql80-community-release.noarch : MySQL repository configuration for yum
perl-DBD-MySQL.aarch64 : A MySQL interface for Perl
perl-DateTime-Format-MySQL.noarch : Parse and format MySQL dates and times
php8.1-mysqlnd.aarch64 : A module for PHP 8.1 applications that use MySQL databases
php8.2-mysqlnd.aarch64 : A module for PHP 8.2 applications that use MySQL databases
postfix-mysql.aarch64 : Postfix MySQL map support
=================================== Summary Matched: mysql ====================================mariadb105-devel.aarch64 : Files for development of MariaDB/MySQL applications
mariadb105-server-utils.aarch64 : Non-essential server utilities for MariaDB/MySQL applicationsperl-DBD-MariaDB.aarch64 : MariaDB and MySQL driver for the Perl5 Database Interface (DBI)
Asked By: Brayan Tiwa


You said this was a normal fedora, so a simple

sudo dnf install mysql

would install a MySQL server. Done!

(You might notice that the package you’re getting might be called mariadb, but that doesn’t change the fact you’re getting MySQL. It’s just that the software that is now called "MySQL" is a fork of the original MySQL under a different license for commercial reasons of Oracle. "MariaDB" is a different fork of what is originally called "MySQL", the one that continues the community-oriented development. If you want a LAMP setup, you generally want MariaDB, not the new MySQL, unless you have an expensive service contract with Oracle – but then you wouldn’t come here for installation advice, but use their service, I guess.)

Turns out you have Amazon Linux, not Fedora. Try installing dnf install mariadb.

Answered By: Marcus Müller

This is a full description of this response.

After being logged(using Putty or Termius), i ran these commands:

$ sudo wget https://dev.mysql.com/get/mysql80-community-release-el9-1.noarch.rpm 

$ sudo dnf install mysql80-community-release-el9-1.noarch.rpm -y

$ sudo dnf install mysql-community-server -y

At this moment i got errors:

MySQL 8.0 Community Server                                     3.0 MB/s | 3.1 kB     00:00    
GPG key at file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022 (0x3A79BD29) is already installed
The GPG keys listed for the "MySQL 8.0 Community Server" repository are already installed but they are not correct for this package.
Check that the correct key URLs are configured for this repository.. Failing package is: mysql-community-client-8.0.36-1.el9.aarch64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
Public key for mysql-community-client-plugins-8.0.36-1.el9.aarch64.rpm is not installed. Failing package is: mysql-community-client-plugins-8.0.36-1.el9.aarch64

I solved it with the command:

$ sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023


$ sudo yum --enablerepo=mysql80-community install mysql-community-server

$ sudo systemctl start mysqld


Answered By: Brayan Tiwa

You thought you were on Fedora, but are actually on Amazon Linux 2023.

The recommended way of getting a MySQL server is to install the MariaDB package (see this other answer for a discussion of MariaDB vs MySQL). If you’re just going to use this with PHP, taking the unsupported route and adding a third party repo is not what I’d recommend.

A simple

dnf install mariadb105-server
# if you use a future version of amazon linux:
# dnf install mariadb*-server
# to get whatever the system has

will get you a MySQL server, which all other mysql/mariadb tools on your amazon Linux are built against.

Answered By: Marcus Müller