Install MySQL on EC2 Ubuntu |
X

Congrats, You are Subscribed to Receive Updates.

Install MySQL on EC2 Ubuntu


Introduction

Install MySQL on EC2 Ubuntu is pretty simple to install it. Installing PHPMyAdmin also needy thing for better UI. I wrote an article about installing Apache2 and PHP on Amazon AWS. You can read it from here.

Let’s start with easy steps which we will continue after installing Apache and PHP. This requires you to read my previous article regarding the Apache installation. It helps to setup your basic things. You have to start with your Putty and for Ubuntu users connect through Terminal.

There after you can use the following commands to install MySQL on your AWS EC2 Instance.

Install MySQL

The very first command is to update the server if any package or config is missing. it will be refreshed with below command.

sudo apt-get update

After that, you need to install MySQL Server with help of below command.

sudo apt-get install mysql-server

The above one installs Just MySQL server on your AWS Instance.

Install-MySQL-on-EC2-Ubuntu

But you need to configure it inside PHP to work  without Apache2 server.

sudo apt-get install php-mysql

Now, you need to install Phpmyadmin to use better GUI to work on mysql server.

sudo apt-get install phpmyadmin

That’s it  you have done the installations,  Let’s Do a small configuration thing to make our PHPMyAdmin work in our installed Apache. Just  follow the below directory structure. /etc/apache2/apache2.conf

include below line of code to work it.

# PhpMyAdmin Confuiguration
Include /etc/phpmyadmin/apache.conf

After that, Restart your apache sudo service apache2 restart and make sure your phpmyadmin is working by typing your AWS IP Address followed by phpmyadmin like the below one.

http://xxx.xxx.xx.x/phpmyadmin

That’s it.

Password Trouble to login

If you have problem with login password, you need to reset the password for root user. As of one customers comment, I am updating with the solution in detail.

  1. get into your mysql server without password.
sudo mysql

2.  Select the Database to update the root password

use mysql;

3. Change the password for root login.

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Hope it helps to login without trouble.

commenter

About Varadharaj V

The founder of Kvcodes, Varadharaj V is an ERP Analyst and a Web developer specializing in WordPress(WP), WP Theme development, WP Plugin development, Frontaccounting(FA), Sales, Purchases, Inventory, Ledgers, Payroll & HRM, CRM, FA Core Customization, PHP and Data Analyst. Database Management Advance Level

2 comments

  1. commenter

    To update the mysql server root user password. use the following mysql query

    ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’;

    And to enter into mysql, just use the below one.

    sudo mysql

Comment Below

Your email address will not be published. Required fields are marked *

*

Current ye@r *

Menu

Sidebar