Installing phpMyAdmin on RedHat Linux
phpMyAdmin is a great tool for managing software, it's easy to use, fast and best of all, free.
It is usually pre-installed on development stacks, such as XAMMP and MAMP. However, for dedicated servers - you sometimes need to get it on. Even though you may be able to use command line for managing your databases or even a remote GUI application - clients need something easy to use.
In my case I am installing on RedHat Linux.
- Navigate to a directory where you can download the phpMyAdmin install. E.g. cd /var/www
- Goto http://www.phpmyadmin.net/home_page/downloads.php and copy the link of the latest phpMyAdmin or most suitable. You will want the one with the tar.gz extension so we can extract it later. E.g copy the URL "http://sourceforge.net/projects/phpmyadmin/files%2FphpMyAdmin%2F3.4.3.1%..."
- Now we want to get the file from the web onto our server. So we use the WGET command. So we execute the command wget http://sourceforge.net/projects/phpmyadmin/files%2FphpMyAdmin%2F3.4.3.1%...
- We now have the file, let's extract it.Navigate to the directory you downloaded phpMyAdmin, cd /var/www. Then use the following to extract, tar xzf phpMyAdmin-3.4.3.1-english.tar.gz.
- After extraction, rename the directory to be friendly, mv phpMyAdmin-3.4.3.1-english phpMyAdmin.
- Now we want the client to be able to login via a http page (login page). So we copy the sample config file, cp config.sample.inc.php config.inc.php and edit it using vi config.inc.php.
- Find the line that says $cfg['Servers'][$i]['auth_type'] = 'cookie'; and change 'cookie' to 'http'.
- Now let's create a config file for Apache to pickup. vi /etc/httpd/conf.d/phpmyadmin.conf
- Copy and paste the following Apache directives, which allows phpMyAdmin to be accessed:
Alias /phpmyadmin /var/www/phpMyAdmin
‹Directory "/var/www/phpMyAdmin"›
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
SSLRequireSSL
‹/Directory› - Restart your Apache via your user interface or using the command service httpd restart.
- Check that phpMyAdmin is working via www.your-domain.com/phpMyAdmin
. The username and password is simply those of your MySQL. If there are any problems check your log files.
Further to this, if your phpMyAdmin setup is strictly for your clients, I would disable the root login. This would ensure no-one can take total control of your MySQL server through your root login.
This may differ on phpMyAdmin version but vi your config file that we created earlier and find the line that may be along the lines of:
$cfg['Servers'][$i]['AllowRoot'] = TRUE;
If you can't find the line, simply add this line and change TRUE to FALSE to disable the root login. Ensure that the snytax follows other lines in the config. For example, [$i] may not be included in future versions of phpMyAdmin.
Restart your apache and test your root login. If you can still login using root, then the line in your config is incorrect. Again, ensure the syntax of your nw line is correct.
