mySQL administrative tools

Feb 12, '01 11:47:12PM

Contributed by: robg

If you've installed mySQL and PHP for creating web-enabled databases, you've probably become quite familiar with the pure UNIX interface to mySQL. For example, you'd type DESCRIBE tablename for a list of the field definitions in a table; to add a row to a table, the syntax is INSERT INTO tablename (fieldname1, fieldname2) VALUES (expression1, expression2). In other words, completely un-Mac-like and non-intuitive ... but quite powerful!

While you can't avoid all of this hassle of the non-GUI interface, there are a couple of tools out there that make managing mySQL databases much easier. The first is an OS X (Carbon) application called MacSQL Monitor from Runtime Labs. This is a shareware ($40) package that puts a very nice Mac GUI on your mySQL databases. The demo version has limited export capabilities, and will run 10 queries each session.

My personal favorite, though, is phpmyadmin, from phpwizard.net. This is a collection of PHP scripts designed to help you manage mySQL databases, and it's available free of charge. Through the web-based interface, you can easily create tables, browse records, run queries, modify properties, drop tables, and add/delete entire databases. It's the tool I use when I have to work in the raw database files on the macosxhints website. Read the rest of this article if you'd like an overview of installing myphyadmin.

The installation process is really quite simple. First, download the package from the phpwizard.com website. You can download a version for files named with .php or .php3; I have my server configured for .php files, so that's the one I chose. Once it's downloaded, unzip or untar the file. This creates a folder called phpMyAdmin_2_1_0_0, inside of which is another folder called phpmyadmin. Inside of that folder is a Documentation.html file. Open this in your browser, and read and follow its instructions relative to securing your database! Keep in mind that if your machine is publicly connected, phpmyadmin will technically be usable over the net!

Next, edit the config.inc.php file and replace host (usually localhost if you're using it locally), username, and password with applicable values for your setup. Once that's done, I simply moved the phpmyadmin directory to the /Library/WebServer/Documents folder, and then opened 127.0.0.1/phpmyadmin/index.php in my browser. I was now looking at an overview of all my local databases and their tables. Structures are easily viewed, and you can browse the records in any table with the click of a button. phpmyadmin has saved me literally hours of work over the few months that I've been using it - highly recommended!

Comments (6)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20010212234712292