How to Install MySQL on Amazon Linux 2023

Felix Mulei
3 min readJul 12, 2023


Since AWS introduced the new AMI, Amazon Linux 2023, a lot of us have been struggling with some installations including installing MySQL.

In this tutorial, I’m going to be show you how to go about installing MySQL in Amazon Linux 2023. The new AMI is based on Fedora and thus the commands that were previously executed in Amazon Linux 2 may not work.


Before you can install MySQL, you will need to have the following prerequisites:

An Amazon Linux 2023 instance
A terminal window

Creating an Ec2 Instance.

On the AWS management console head over to the EC2 dashboard and click on launch instance. Give the required details and make sure on the Amazon Machine Image (AMI) the Amazon Linux 2023 AMI is selected and then click on launch.

Launching the instance

After the instance if fully booted grab the public IP address and ssh to the instance.

ssh -i <keypair path> ec2-user@<public ip address>

After connecting we will download the RPM file using this

sudo wget 

You can confirm the file has been downloaded by running

ls -lrt

After downloading the next step is to install the file then install mysql-community-server using the below commands

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

Next step is to start mysql

sudo systemctl start mysqld

By default, we will not be able to connect, thus we need to modify the .cnf file to enable us log in without a password. We will do this by adding a line to the mysqld block

sudo vi /etc/my.cnf

After modifying the file save and restart mysql again by running

sudo systemctl restart mysqld

Afterwards we should be able to connect by typing mysql

Thank you