Install MySQL on EC2 Ubuntu
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.
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.
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.
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.
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.
- get into your mysql server without password.
2. Select the Database to update the root password
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.