phpMyAdmin is a web based interface to MySQL which is written using PHP for Administration of databases. Visual interface provided is intuitive and it saves time for the developers. (ver 3.1.1 is the recommended version as of this writing which runs on PHP 5/MySQL 5)
Step 1: First we need to check MySQL is installed by issuing the following command
[root@user Desktop]# which mysql
If you get …
/usr/bin/mysql
then, it is an indication that MySQL is installed in your machine.
If you get …
which: no mysql in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
This will give an indication if MySQL is installed or not. If it is not installed then issue
[root@user Desktop]# yum install mysql
Step 2: Then check if PHP installed by issuing the command
[root@user Desktop]# which php
If you get …
/usr/bin/php
then, it is an indication that PHP is installed in your machine.
To get the version of PHP installed in your machine, type
[root@user Desktop]# php –version
If php is not installed then type
[root@user Desktop]# yum install php
Step 3: phpMyAdmin pre-configuration steps
[root@user Desktop]# yum install php-gd php-mcrypt php-mbstring
We first install a set of Apache HTTP Server modules required for phpMyAdmin
Download location for phpMyAdmin
http://www.phpmyadmin.net/home_page/downloads.php
Step 4: phpMyAdmin configuration on CentOS/RedHat
Create the configuration file by typing the following command
[root@user Desktop]# cp /var/www/html/phpMyAdmin/config.sample.inc.php /var/www/html/phpMyAdmin/config.inc.php
Edit the configuration settings of phpMyAdmin
[root@user Desktop]# vi /var/www/html/phpMyAdmin/config.inc.php
The following is a basic setting for phpMyAdmin configuration. You can play with the below setting
by assigning user name, password or setting the authentication type to ‘cookie’ instead of ‘http’ or
having a different folder setting for saving/loading files.
/* Authentication type */
$cfg[‘Servers’][$i][‘auth_type’] = ‘http’;
/* Server parameters */
$cfg[‘Servers’][$i][‘host’] = ‘localhost’;
$cfg[‘Servers’][$i][‘connect_type’] = ‘tcp’;
$cfg[‘Servers’][$i][‘compress’] = true;
/* Select mysqli if your server has it */
$cfg[‘Servers’][$i][‘extension’] = ‘mysql’;
/* User for advanced features */
$cfg[‘Servers’][$i][‘controluser’] = ”;
$cfg[‘Servers’][$i][‘controlpass’] = ”;
.
.
.
.
/*
* Directories for saving/loading files from server
*/
$cfg[‘UploadDir’] = ‘tmp’;
$cfg[‘SaveDir’] = ‘tmp’;
Step 5: Permission settings for the configuration file – phpMyAdmin
After making the necessary changes, type the following command change the permission of the
configuration file to not allow world to read or write.
[root@user Desktop]# chmod -R 0750 /var/www/html/phpMyAdmin/config.inc.php
ERROR 1:
If you had moved phpMyAdmin extracted folder into /var/www/html/phpMyAdmin you might get a message (SELinux: AVC denial error),
SELinux is preventing the httpd from using potentially mislabeled files (/var/www/html/phpMyAdmin).
In the above case, type
[root@user Desktop]# restorecon -R -v ‘/var/www/html/phpMyAdmin’
Now browse to the folder, http://localhost/phpMyAdmin and the you should be able to see phpMyAdmin
interface.
If there are any version conflicts related to PHP, those get shown for you now. Depending on the
PHP version, that is intalled in your machine, you can download the related phpMyAdmin
ERROR 2:
If you have not set a password for the default ‘root’ account when you installed MySQL, you will
get the error “Your configuration file contains settings (root with no password) that corresponds to
the default MySQL privileged account. Your MySQL server is running with this default, is open to
intrusion, and you really should fix this security hole.”
If this is the case then follow the below set of instructions
[root@user Desktop]# mysql -uroot
mysql> set password for ‘root’@’localhost’ password = PASSWORD(‘your_password’);
mysql> quit;
This will remove the error message that will see in the phpMyAdmin interface when default password
for the ‘root’ user is not set.