How to Install and Configure phpMyAdmin on CentOS 6

Select distribution:
Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Deprecated

This guide has been deprecated and is no longer being maintained.

Create a Linode account to try this guide with a $100 credit.
This credit will be applied to any valid services used during your first 60 days.

phpMyAdmin is a web application that provides a GUI to aid in MySQL database administration. It supports multiple MySQL servers and is a robust and easy alternative to using the MySQL command line client.

Note
This guide is written for a non-root user. Commands that require elevated privileges are prefixed with sudo. If you’re not familiar with the sudo command, you can check our Users and Groups guide.

Before You Begin

  1. If you have not already done so, create a Linode account and Compute Instance. See our Getting Started with Linode and Creating a Compute Instance guides.

  2. Follow our Setting Up and Securing a Compute Instance guide to update your system and configure your hostname. You may also wish to set the timezone, create a limited user account, and harden SSH access.

    To check your hostname run:

    hostname
    hostname -f
    

    The first command should show your short hostname, and the second should show your fully qualified domain name (FQDN) if you have one assigned.

  3. Set up a working LAMP stack. Please see the LAMP on CentOS 6 guide if needed.

    Note
    If you have installed the php-suhosin package, there are some known issues when using phpMyAdmin. Please visit the Suhosin phpMyAdmin Compatibility Issues page for more information about tuning and workarounds.
  4. Enable the EPEL Repository:

    cd ~
    wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    sudo rpm -ivh epel-release*
    
  5. Set up Apache with SSL, so your passwords will not be sent over plain text. To do so, go through the SSL Certificates with Apache on CentOS guide.

  6. Install the mycrypt PHP module:

    sudo yum install php-mcrypt
    
  7. Restart Apache:

    sudo service httpd restart
    

Installing phpMyAdmin

  1. Install phpMyAdmin:

    sudo yum install phpmyadmin
    
  2. For each virtual host that you would like to give access to your PHPMyAdmin installation, you must create a symbolic link from the document root to the phpMyAdmin installation location (/usr/share/phpmyadmin):

    cd /var/www/example.com/public_html
    sudo ln -s /usr/share/phpmyadmin
    

    This will create a symbolic link named phpmyadmin in your document root.

Configuring phpMyAdmin

By default, phpMyAdmin is configured to only permit access from the localhost (127.0.0.1). You will want to add the IP address of your computer in order to access it.

  1. Make note of the external IP address being used by your home or work computer. This can be found by visiting the following website:

    http://www.whatismyip.com
    
  2. Edit the configuration file located at /etc/httpd/conf.d/phpMyAdmin.conf, replacing the four instances of 127.0.0.1 with the IP address of your home or work computer.

Force SSL

Since you are required to enter your MySQL credentials when using phpMyAdmin, we recommend that you use SSL to secure HTTP traffic to your phpMyAdmin installation. For more information on using SSL with your websites, please consult the guides that address SSL certificates.

  1. Force phpMyAdmin to use SSL in the phpMyAdmin configuration file /etc/phpmyadmin/config.inc.php by adding the following lines under the Server(s) configuration section:

    File: /etc/phpmyadmin/config.inc.php
    1
    
    $cfg['ForceSSL'] = 'true';
  2. Restart Apache:

    sudo service httpd restart
    

Testing Your phpMyAdmin Installation

To test phpMyAdmin, open your favorite browser and navigate to https://example.com/phpmyadmin. You will be prompted for a username and password. Use the username “root” and the password you specified when you installed MySQL. Alternatively, you can log in using any MySQL user and retain their permissions.

If you can successfully log in, phpMyAdmin has been installed properly.

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

This page was originally published on


Your Feedback Is Important

Let us know if this guide made it easy to get the answer you needed.


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.