Amazon has a good explanation but you may run into some issues. The link below is the Amazon user guide for installing the all the packages necessary for running a WordPress or other application that uses PHP and MySQL. You can follow my process below as you may need to install a specific version of MySQL as I had to.
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html
Linux Command Line Install MySQL
The below commands will install MySQL version 6.5.
sudo yum localinstall http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm -y
sudo yum install mysql-community-server -y
Install phpMyAdmin after you have MySQL installed
sudo yum –enablerepo=epel install phpmyadmin
sudo ln -s /usr/share/phpMyAdmin /var/www/html/phpmyadmin
After phpMyAdmin is installed you will need to go the the phpMyAdmin config file and allow your IP address to be able to access it remotely.
sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
Find the section below:
<Directory/usr/share/phpMyAdmin/><IfModulemod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny></IfModule><IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule></Directory>
Comment out the “Deny from All” line and change “Allow from 127.0.0.1” to your IP address.
To find your IP Address go to http://www.whatsmyip.org
Reference for phpMyAdmin install
http://superuser.com/questions/291230/how-to-install-phpmyadmin-on-linux-ec2-instance
If you have issues you can use the command below to remove phpMyAdmin
sudo yum erase phpmyadmin
After you have MySQL installed and phpMyAdmin setup you can start the MySQL service by running:
service mysqld start
You can now login to MySQL to setup your users for phpMyAdmin
mysql -u root -p
Setup User for phpMyAdmin
CREATE USER ‘youruser’@’localhost’ IDENTIFIED BY ‘yourpassword’;
GRANT ALL PRIVILEGES ON *.* TO ‘youruser’@’localhost’
IDENTIFIED BY ‘yourpassword’ WITH GRANT OPTION;
If you run into an issue with MySQL you can uninstall using procedure below
1. Uninstall mysql server and clients: do a
sudo yum list installed | grep mysql
and uninstall all mysql-related packages (with “yum remove”)
2. Delete the databases folder
sudo rm -rf /var/lib/mysql/
3. if you have the remi repo enabled, disable it:
sudo vi /etc/yum.repos.d/remi.repo (and set enabled = 0)
4. Re-install mysql and mysql-server:
sudo yum install mysql
sudo yum install mysql-server
5. Start mysql and run mysql_secure_installation
sudo /usr/bin/mysql_secure_installation
Reference:
http://venakis.blogspot.com/2011/12/completely-wipeout-mysql-from-centos-to.html
Secure MySQL installation location
/usr/bin/mysql_secure_installation
AWS AMI:
http://aws.amazon.com/amazon-linux-ami/2014.09-release-notes/