Free collection of beautiful vector icons for your web pages.

How to install MySQL and phpMyAdmin on AWS EC2 Cloud9?


This page explains how to install and configure MySQL and phpMyAdmin on a freshly AWS EC2 Cloud9 environement with the following versions:

Reading the following pages is recommended before installing MySQL and phpMyAdmin:

The following assumes that Apache is installed and properly configured.

Install MySQL

AWS Cloud9 environements come with MySQL already installed. Launch a terminal (Alt-T), and run the following command:

sudo service mysql status

MySQL is active and running:

MySQL installed and running on an Amazon AWS EC2 Cloud9 environment

MySQL is installed with a root user. It is not safe to work with this user. Let's create a new MySQL user. First log in MySQL with the root user (no password):

sudo mysql -u root

Create the new user (replace username and password by the expected values):

mysql> CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

Then, grant your new user the appropriate privileges:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;

Exit MySQL prompt :

mysql> exit

You can check that you new user is created by log-in in MySQL (exit to quit MySQL prompt):

mysql -u username -p

Install phpMyAdmin

Install phpMyAdmin with the following command:

sudo apt install phpmyadmin php-mbstring php-gettext

You'll be asked several questions while installing phpMyAdmin:

First, select Apache2 as web server:

Select Apache2 server while installing phpMyAdmin

Click yes to configure database with dbconfig-common:

Configure database with phpMyAdmin

Enter and confirme your phpMyAdmin password:

Enter a phpMyAdmin password

Once installation is over, click on Preview Running Application and add /phpmyadmin/ at the end of the URL.

If phpMyAdmin is not working properly, try one of the following:

Once you get the following page, login with the MySQL username and password created previously:

Home page of freshly installed phpMyAdmin

Et voilà !

See also

Last update : 01/07/2021