Feb 242014
 
Article MySQL

phpMyAdmin is probably the most well-known database management tool for MySQL databases. Besides allowing the administrator to browse the objects in the database through a graphical web frontend, phpMyAdmin also mase easy to carry out many common DBA maintenance tasks. This post explains how to install and configure phpMyAdmin on a Linux distro.

1. phpMyAdmin installation pre-requisites

Check that PHP version 5 or above is installed on the system:

Check that MySQL version 5 or above is installed on the system:

and, of course, there must be also an Apache web server installed on the system.

PHP5 modules

If a PHP interpreter was not previously installed on the system where phpMyAdmin is to be installed, it is advisable to perform a PHP installation from source. The “configure” command below ensures that all PHP modules required by phpMyAdmin will be included in the executable:

If some of the required modules has not been compiled into the PHP executable, phpMyAdmin will display the following error messages:

  • GZip – GZip compression and decompression requires functions (gzencode) which are unavailable on this system.
  • Bzip2 – Bzip2 compression and decompression requires functions (bzopen, bzcompress) which are unavailable on this system.
  • ZIP – Zip decompression requires functions (zip_open) which are unavailable on this system.
  • ZIP – Zip compression requires functions (gzcompress) which are unavailable on this system.

2. Download and install phpMyAdmin under the Apache DocumentRoot

The root of our web server is defined by the “DocumentRoot” directive in the apache configuration file:

The latest phpMyAdmin release can be downloaded from www.phpmyadmin.net. At the time this post is being written, the most recent version is 3.5.5; the file available for download is phpMyAdmin-4.1.8-all-languages.tar.gz (8 MB). Once downloaded, the file is uncompressed under the DoucumentRoot, and renamed to “phpmyadmin”:

NOTE: Instead of renaming the directory, a symbolic link could be created, to keep the reference to the installed version:

3. Create a phpmy user to protect the phpmyadmin directory

Create a unix user “phpmy”:

Check the group name used by Apache:

Set “phpmy” as the owner, and the apache group above as the group of the “phpmyadmin” directory:

4. Edit the phpMyAdmin configuration file config.inc with the help of the wizard

The phpMyAdmin configuration file “config.inc” can be manually edited, but it is also possible to use the configuration wizard. To do this, an empty configuration file is first created:

Next, point the browser to the configuration wizard at the URL “http://localhost/phpmyadmin/setup/index.php” (if the server where the installation is being carried out is not the same system where the browser is running, replace “localhost” with the IP address or server name):

phpmyadmin-en

Next, click on “New Server”:

phpmyadmin-newserver

In this form, fill in the field “Verbose name of this server”, leaving the default value of the other fields, and click on “Apply”:

  • Verbose name of this server – For instance, “WordPress & Joomla Database”

After this step, several warning will be displayed about the use of SSL, Blowfish secret, etc. They can be ignored for now. Once the configuration is done, move the “config.inc” file under the phpmyadmin directory, and delete the “config” directory:

5. Access phpMyAdmin

Finally, we can use the url “http://localhost/phpmyadmin/index.php” to access the login screen:

phpmyadmin-login

Pantalla de acceso a phpMyAdmin

On accessing the login form, a message “Cannot load mcrypt extension. Please check your PHP configuration.” might be displayed. This happens if the PHP interpreter used was not compiled with the mcrypt module. In this case, we must install the libmcrypt and libmcrypt-devel packages, and compile again PHP from source, using the option –with-mcrypt.

The username and password to enter in the login form is the mysql administration user (usually “root”) and password we use to connect to mysql from the command line. Once logged in, we can access all the functionality offered by phpMyAdmin to manage our data bases from a browser:

phpmyadmin-databases

Index of posts related to MySQL

 Posted by at 2:44 pm

 Leave a Reply

(required)

(required)