This post is syndicated from Sanket's Blog :http://sanketdangi.com/post/56623052533/phpmyadmin-on-amazon-ec2-manage-amazon-rds
The installation procedure of PHPMYADMIN is very simple and there are numerous blogs available across internet which will help you to configure phpmyadmin.
Even, I followed same blogs/articles to configure phpmyadmin on Amazon EC2. But things didn’t clicked for me instantly. I figured out the solution for some of the problems and thought of writing a post on this.
There are two ways to configure phpmyadmin :
1. Download phpmyadmin package and install that.
2. Installing through repositories by enabling epel
I followed 2nd procedure.
Installation Steps :
1. To install phpmyadmin package :
# sudo yum --enablerepo=epel install phpmyadmin
2. Navigate to file "/etc/httpd/conf.d/phpMyAdmin.conf" and make sure you can access phpMyAdmin from outside (your local pc).
<Directory /usr/share/phpMyAdmin/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
# Require ip 127.0.0.1
Require ip <Add-your-IP>
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 <Add-your-IP>
Allow from ::1
</IfModule>
</Directory>
3. Edit mysql host in config.inc.php file
In order to access RDS database, we need to modify mysql host in config.inc.php file. Most of the blogs across web points to /usr/share/phpMyAdmin folder and copying config.sample.inc.php as config.inc.php. But modifying mysql host in this file didn’t work for me.
In order to get that working, I had to modify config.inc.php in /etc/phpMyAdmin.
# sudo vi /etc/phpMyAdmin/config.inc.php
Modify
$cfg['Servers'][$i]['host'] = 'localhost';
to
$cfg['Servers'][$i]['host'] = 'xxxxxxxxxxx.cny3hl5jk7fs.us-east-1.rds.amazonaws.com'; //Your-RDS-Instance-Endpoint
4. Perform httpd restart
# sudo yum install httpd
5. Browse PHPMYADMIN on your browser
http://<Elastic-IP-Address>/phpmyadmin
If you face below mentioned error :
#2002 - Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
The server is not responding (or the local server’s socket is not correctly configured).
Then most probably, you haven’t modified mysql host in config.inc.php present in/etc/phpMyAdmin. Modifying mysql host in config.inc.php present in/usr/share/phpMyAdmin may not work for you.
No comments:
Post a Comment