We will learn about “How to Install MySQL 8 on Amazon Linux 2 EC2”, we will look at the installation for MySQL 8 step by step in Amazon Linux 2 EC2 .
MySQL is the Relation Database, which is used to store the data. It Is open-source and widely used in the industries.
MySQL written in C and C++. It has also been tested to be a “fast, stable and true multi-user, multi-threaded SQL database server”.
First, we will download the MySQL 8 Community Edition installer for Amazon Linux 2 EC2.
Now right-click on “Download” and then select “Copy link address” and move to a terminal to download the bundle of MySQL 8.
So, now we will install wget in Amazon Linux EC2 to download the MySQL Packages.
# yum install wget
The QUICK view to installing MySQL in Linux read the POST to get detailed knowledge about the installation.
Quick view to Install MySQL 8 on Amazon Linux 2 EC2
Install MySQL 8 on Amazon Linux 2 EC2 Step by Step
STEP 1: Download the Package of MySQL Community Edition in Amazon Linux 2 EC2.
# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.25-1.el8.x86_64.rpm-bundle.tar
So, once the file has been downloaded as “mysql-8.0.25.X.X.rpm-bundle.tar” next, we have to extract the file using tar command.
STEP 2: Extract the Package of MySQL 8 on Amazon Linux 2 EC2.
# tar -xvf mysql-8.0.25-1.el8.x86_64.rpm-bundle.tar
So, after extraction now lets install the packages using the rpm command.
STEP 3:Install the Package of MySQL 8 using rpm and yum command on Amazon Linux 2 EC2.
So, before installing we got some dependencies error.
Let’s install the dependencies intoAmazon Linux 2 EC2
# yum install perl-Data-Dumper perl-JSON openssl-devel -y
And then use rpm command to install the MySQL 8 Package in Amazon Linux 2 EC2.
# rpm -vih *.rpm
STEP 4: Start the service of MySQL in Amazon Linux 2 EC2.
# systemctl start mysqld
Start the service using systemctl command and if we want to start the service at the time of booting use below command.
# systemctl enable mysqld
STEP 5: Configure MySQL in Amazon Linux 2 EC2.
So, after that check, the “mysqld.log” in /var/log/ folder, were you will get the temporary password.
# cat /var/log/mysqld.log
We can see the logs very clearly the logs, let’s set our own password using “mysql_secure_installation”
[[email protected] ~]# mysql_secure_installation
So, you can “Enter a password of your choice” but there is some policy in MySQL for the password.
- The password length should be 8 or more than that.
- There should be one special character like “@#$!”
- There should be one UPPER case letter.
- Finally, there should be one LOWER case letter.
So then it will ask to remove the anonymous user press “y” to remove.
Next, it will prompt to Disallow root login remotely? means if we want to login from the root user remotely, press y|Y or press any other key to No.
So after that, it will ask to remove the test database and reload the changes and that’s Done.
STEP 6: Check the version of installed MySQL 8 on Amazon Linux 2 EC2.
So we can check the version with two ways, by using the –version parameter with “mysql” command.
# mysql –version
Also, we can check the version by take login to the MySQL 8 server.
# mysql -h localhost -uUsername -pPassword
Let’s check the database after login, use “>show databases”
mysql> show databases;