How to Install and Configure phpMyAdmin on Debian 8

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.
Create a Linode account to try this guide with a $ credit.
This credit will be applied to any valid services used during your first  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. Ensure that you have followed the Getting Started and Securing Your Server guides and the Linode’s hostname is set.

    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).

  2. Update your system:

    sudo apt-get update && sudo apt-get upgrade -y
    
  3. Set up a working LAMP stack. Please see the LAMP on Debian 8 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. 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 Debian & Ubuntu guide.

  5. Install the mcrypt PHP module:

    sudo apt-get install mcrypt
    
  6. Restart Apache:

    sudo systemctl restart apache2
    

Setting Up phpMyAdmin

  1. Install the current version of phpMyAdmin:

    sudo apt-get install phpmyadmin
    

    You will be asked which server to automatically configure phpMyAdmin for. Select “apache2.” When asked to configure database for phpmyadmin with dbconfig-common, select yes.

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

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

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

Securing phpMyAdmin

.htaccess File

Secure your phpMyAdmin directory using an .htaccess file that only allows specified IP addresses to access it. You can do this by creating an .htaccess file in your phpmyadmin directory. Substitute the proper paths and IP addresses for your particular configuration:

File: /var/www/html/example.org/public_html/phpmyadmin/.htaccess
1
2
order allow,deny
allow from 12.34.56.78

Force SSL

You can 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';

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.

This page was originally published on


Your Feedback Is Important

Let us know if this guide was helpful to you.


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.
The Disqus commenting system for Linode Docs requires the acceptance of Functional Cookies, which allow us to analyze site usage so we can measure and improve performance. To view and create comments for this article, please update your Cookie Preferences on this website and refresh this web page. Please note: You must have JavaScript enabled in your browser.