sudo yum update -y
#The Amazon Linux default repositories contains Mariadb packages for the installation. To install MySQL community relese, first configure MySQL yum repository on your machine.
sudo rpm -Uvh https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
#After that run the following command to install the MySQL 5.7 packages on your systems. This will also install all other required dependencies.
sudo yum install mysql-community-server
#Once the MySQL installation completed on your Amazon Linux system. You need to enable the MySQL service to start on system boot. Also, start service using the following commands:
sudo systemctl enable mysqld
sudo systemctl start mysqld
#Once you start MySQL server for the first time, an auto generated password is set for the root account. You can find this password in MySQL logs.
sudo grep 'temporary password' /var/log/mysqld.log
sudo yum update -y
sudo yum install -y mariadb-server
sudo systemctl enable mariadb
sudo systemctl start mariadb
sudo mysql_secure_installation