Procedure to Install MySQL on AWS EC2 Linux
To install MySQL server on AWS EC2 virtual machine, connect to your EC2 virtual machine. For that, simply select your virtual machine and click on the “Connect” button:
After that, simply select the “SSH client” tab and copy the command given as an example on this page. Simply paste that command in either the command prompt or PowerShell then change the file path with the file location on your PC.
After the command, you need to hit enter, and you will be connected to your EC2 Linux through the SSH terminal.
Once you are connected to your EC2 instance, it is always a good practice to ensure that your apt packages are all up to date, to do exactly that, run the following command:
After completing the updates, enter the command for installation.
Simply write the following command and hit “enter”, then it will prompt you to enter “y” if you want to continue with the installation. Simply enter “y” and press enter one more time.
After verification, your MySQL server is installed on your virtual machine.
Once the installation is done, you can start working the MySQL by heading inside its shell, to do that, type:
After that, type in the password for the root user, and then you will get the following output on the terminal of your EC2 instance:
This means that you are now inside the MySQL shell, and your installation is successful.
Conclusion
Start by connecting to the SSH of your EC2 that is running a Linux based operating system and then update the apt packages. Once that is done, install MySQL, and once the installation process is done, verify it by heading inside the shell of MySQL. This post has taught you the procedure of installing a MySQL server on AWS EC2 running a Linux based OS.