Cara menggunakan ec2 install mysql

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 .

Table of Contents

  • Install MySQL 8 on Amazon Linux 2 EC2 Step by Step
  • Related Posts
  • How do I install MySQL on Linux?
  • How do I install MySQL on a virtual machine?
  • How do I start an EC2 instance MySQL server?
  • How do I add a database to 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

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

2: Extract the Package of MySQL 8 onAmazon Linux 2 EC2.

# tar -xvf mysql-8.0.25-1.el8.x86_64.rpm-bundle.tar

3: Install the Package of MySQL 8 using yum and rpm command on Amazon Linux 2 EC2.

# yum install perl-Data-Dumper perl-JSON openssl-devel -y
# rpm -vih *.rpm

4: Start the service of MySQL 8 on Amazon Linux 2 EC2.

# systemctl start mysqld
# systemctl enable mysqld

5: Configure MySQL with “mysql_secure_installation”.

# mysql_secure_installation

6: Logged in and Check the Database of MySQL in Amazon Linux 2 EC2.

# mysql -h localhost -u[username] -p[password]

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.

Dependencies error

Let’s install the dependencies into Amazon 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 command install
# 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.

Starting the MySQL

So, after that check, the “mysqld.log” in /var/log/ folder, were you will get the temporary password.

# cat /var/log/mysqld.log

Password that to be used in mysql_secure_installation

We can see the logs very clearly the logs, let’s set our own password using “mysql_secure_installation”

[[email protected] ~]# mysql_secure_installation

mysql_secure_installation

So, you can “Enter a password of your choice” but there is some policy in MySQL for the password.

  1. The password length should be 8 or more than that.
  2. There should be one special character like “@#$!”
  3. There should be one UPPER case letter.
  4. Finally, there should be one LOWER case letter.

mysql_secure_installation

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.

mysql_secure_installation

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”

show databases
mysql> show databases;

If you want to Install MySQL 8 on Ubuntu 20.04 then follow the link. If you want to check the POST to Install MySQL in Linux. Want to Install MySQL on Ubuntu 18.04. Install MySQL 8 in Rocky Linux.


How do I install MySQL on Linux?

Installing MySQL Shell with the MySQL APT Repository.

Update package information for the MySQL APT repository: sudo apt-get update..

Update the MySQL APT repository configuration package with the following command: sudo apt-get install mysql-apt-config. ... .

Install MySQL Shell with this command: sudo apt-get install mysql-shell..

How do I install MySQL on a virtual machine?

Installing MySQL.

Start the virtual machine, if you haven't already..

Log in to the virtual machine as the root user..

At the command prompt, type the following command to install MariaDB: ... .

At the Is this ok prompt, type y and then press Enter. ... .

After installation completes, type the following command to start MariaDB:.

How do I start an EC2 instance MySQL server?

6 Steps to Setup and Connect MySQL to EC2 Instance from Ubuntu.

Step 1: Update System Packages and Install MySQL. ... .

Step 2: Configure MySQL Installation. ... .

Step 3: Login into MySQL and Create a User. ... .

Step 4: Grant Access Privileges to User. ... .

Step 5: Connect User with MySQL. ... .

Step 6: Restart MySQL Service..

How do I add a database to EC2?

In the upper-right corner of the AWS Management Console, check the AWS Region. It should be the same as the one where you created your EC2 instance. In the navigation pane, choose Databases. Choose Create database.