On CNET: DJs - A club-worthy USB mixer

Installing and using phpMyAdmin to manage MySQL databases

Tags: Databases, OPEN SOURCE, Vincent Danen, phpMyAdmin, MySQL, server, database, Linux Tips Newsletter

  • Save
  • Print
  • 1

Takeaway: Learn about the Web-based database management tool phpMyAdmin in this Linux tip.

Management of MySQL databases can be fairly straightforward—with the right tools. Using the MySQL command-line client requires a fairly intimate knowledge of MySQL in particular, and the SQL language in general. Not only that, but depending on the size of your terminal, the output of large tables can be quite difficult to read.

A fair number of GUI MySQL clients exist, but perhaps the best is the Web-based phpMyAdmin tool. This tool is a PHP-based front end to the MySQL database that can perform essentially any function to the database you might require. The drawback is that phpMyAdmin must be installed on your Web server, so without proper access restrictions, it's possible that others could tamper with your SQL data.

Tips in your inbox
Delivered each Tuesday, TechRepublic's free Linux NetNote provides tips, articles, and other resources to help you hone your Linux skills.
Automatically sign up today!

Installation is extremely easy. Download phpMyAdmin from http://www.phpmyadmin.net/; the latest version is 2.6.4-pl3. Untar the tarball into a directory of your choice, such as /srv/www/domain.com/html/admin. Change into the newly created phpMyAdmin--2.6.4-pl3/ directory. Before connecting phpMyAdmin to your database, ensure that it is adequately protected. This can be done by creating an .htaccess file containing:

<code>
AuthUserFile /srv/www/domain.com/.htpasswd
AuthGroupFile /dev/null
AuthName admin
AuthType basic
 
<Files *>
Order Deny,Allow
Deny From All
Allow From localhost
require user admin
satisfy any
</Files>
</code>

This makes the assumption that /srv/www/domain.com is not actually served, so the .htaccess file is outside of the Web root (i.e., your DocumentRoot in Apache is /srv/www/domain.com/html). Create the /srv/www/domain.com/.htpasswd file using the htpasswd tool:

<code>
# htpasswd -cm /srv/www/domain.com/.htpasswd admin
</code>

Once you have provided the admin user a password, edit the config.inc.php file that belongs to phpMyAdmin. You'll want to edit the $cfg['PmabsoluteUri'] keyword to point to where phpMyAdmin is installed on your server, then edit the $cfg['Servers'] array. To get up and running quickly, and to be able to edit all the databases on the server, you'll need to provide root credentials:

<code>
$cfg['Servers'][$i]['host']          = 'localhost';
 
$cfg['Servers'][$i]['extension']     = 'mysql';
$cfg['Servers'][$i]['auth_type']     = 'config';
$cfg['Servers'][$i]['user']          = 'root';
$cfg['Servers'][$i]['password']      = 'mysecretrootpass'; 
</code>

Now you should be able to go to http://www.domain.com/admin/phpMyAdmin-2.6.4-pl3/ and access your MySQL data. Rename the directory to phpMyAdmin/ to make it easier to access.

  • Save
  • Print
  • 1

Print/View all Posts Comments on this article

a few more steps to a good configurationCTI_Steve  | 12/22/05
editJaqui  | 12/22/05
Re: a few more steps to a good configurationEjayHire@...  | 01/03/06
phpma user setuplchaniot@...  | 01/03/06
This ToolJaqui  | 12/22/05
Extremely useful toolgdanen@...  | 01/03/06
agreed- and gives some nice tips on "how to" so...andrew.moore@...  | 01/04/06

What do you think?

Article Categories

Security
Security Solutions, IT Locksmith
Networking and Communications
E-mail Administration NetNote, Cisco Routers and Switches
CIO and IT Management
Project Management, CIO Issues, Strategies that Scale
Desktops, Laptops & OS
Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
Data Management
Oracle, SQL Server
Servers
Windows NT, Linux NetNote, Windows Server 2003
Career Development
Geek Trivia
Software/Web Development
Web Development Zone, Visual Basic, .NET
advertisement
Click Here