Manage MySQL with phpMyAdmin on Ubuntu 9.10 (Karmic)

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.

phpMyAdmin is an open source web application written in PHP 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.

We assume you’ve followed the steps outlined in our Setting Up and Securing a Compute Instance . All configuration will be performed in a terminal session; make sure you’re logged into your Linode as root via SSH. We also assume that you have installed a working LAMP stack. For guides on installing a LAMP stack for your distribution, please visit the LAMP guides section of Linode Guides & Tutorials.

Be aware, if you have opted to install 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.

Enabling the “Universe” Repository

The mcrypt PHP module required by phpMyAdmin is contained in the “universe” repository for Ubuntu Karmic. Edit your /etc/apt/sources.list file to enable the “universe” repositories by removing the hash symbol in front of the universe lines. The file should resemble the following example:

File: /etc/apt/sources.list
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## main & restricted repositories
deb http://us.archive.ubuntu.com/ubuntu/ karmic main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic main restricted

deb http://security.ubuntu.com/ubuntu karmic-security main restricted
deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted

## universe repositories
deb http://us.archive.ubuntu.com/ubuntu/ karmic universe
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic universe
deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe

deb http://security.ubuntu.com/ubuntu karmic-security universe
deb-src http://security.ubuntu.com/ubuntu karmic-security universe

When you have saved this file, issue the following command to refresh your system’s package database:

apt-get update
apt-get upgrade  --show-upgraded

Preparing Your Apache Configuration

In order to provide better security, this guide will install phpMyAdmin to an SSL secured Apache VirtualHost. While you can use HTTP to access your phpMyAdmin instance, it will send your passwords in plain text over the internet. Since you will most likely be logging in to phpMyAdmin using your MySQL root user, HTTP is definitely not recommended.

If you need to set up SSL for your host, please refer to our using Apache with SSL guide . Please ensure SSL is enabled for your virtual host before proceeding.

phpMyAdmin requires the mcrypt PHP module. You can install it using the following command:

apt-get install php5-mcrypt

You may need to restart your Apache server daemon for the changes to take effect:

/etc/init.d/apache2 restart

Installing phpMyAdmin

To install the current version of phpMyAdmin on a Debian system use the following command:

apt-get install phpmyadmin

You will be asked which server to configure phpMyAdmin for. Choose your current web server.

phpMyAdmin will be installed to /usr/share/phpmyadmin. During installation, it will be configured for the Apache default site. However, if you are using Apache virtual hosts a little more configuration is needed.

Configuring phpMyAdmin

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)

Change directory to your document root and issue the following commands to create the symbolic link (be sure to substitute the proper paths for your particular configuration):

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

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

Securing phpMyAdmin

.htaccess File

We recommend securing your phpMyAdmin directory using an .htaccess file and only allowing specified IP addresses to access it. You can do this by creating an .htaccess file in your phpmyadmin directory. Refer to the sample .htaccess file below. Be sure to substitute the proper paths and IP addresses for your particular configuration.

File: /srv/www/example.com/public\\_html/phpmyadmin/.htaccess
1
2
3
Order Deny,Allow
Deny from all
Allow from 12.34.56.78

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 guides that address SSL certificates .

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.

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