macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Managing MySQL on Mac OS X
Pages: 1, 2, 3

Assuming you are setting it up yourself, the two files you'll definitely need to concern yourself with are at the top level of the phpMyAdmin directory: config.inc.php and Documentation.html. While I can't duplicate that information in this article, there are a handful of critical variables that need setting in the config file, which I'll touch on briefly. Read the documentation for full details.



The first one is not too far from the top of the config.inc.php file: PmaAbsoluteUri, which is just the full web address for your phpMyAdmin directory. Assuming you've renamed it to phpmyadmin and put it in your Sites folder, that line will look like this:

$cfg['PmaAbsoluteUri'] = 'http://localhost/~username/phpmyadmin/';

Farther down in the file, under the "Server(s) configuration" section:

$cfg['Servers'][$i]['host']          = 'localhost';

Substitute your MySQL server hostname where it says localhost above. Then just below that:

$cfg['Servers'][$i]['user']         = 'username';
$cfg['Servers'][$i]['password']     = 'password';

These are the username and password for your user account on the MySQL database server. Once more, these are different than your web server login information.

Once you have phpMyAdmin configured and you've confirmed you can log in, you'll want to have a scan through the online documentation to get a sense of what's available -- quite helpful if you're already familiar with MySQL and just want to see what you can and can't do. On that note, while you can't (arguably) administer things as easily as with MySQL Administrator, there are a few basic options that you might want to familiarize yourself with, so that you can do things in more than one place. I highly recommend the user privileges section for starters.

The Command Line

Loved by some, feared by others, the all-powerful command line offers some of the best options for controlling MySQL . . . if you know what you're doing. Also, if you're in a situation where your only access to your server is via SSH and a terminal, using the command line might just save the day.

Now, this might just be me, but I've actually found a lot of value in using this option as a training tool for new users. By showing them the literal grammar of what's going on -- SELECT name FROM USERS WHERE hat = 'Stetson' -- gives them both a sense of what's really being done, and a foundational vocabulary when they turn around and use other programs, whether GUI or web-based.

You can get started with the command line by checking out the online documentation. I'd even recommend downloading the docs locally so you have them at the ready, for easy reference while you're learning and working.

A Note on CocoaMySQL

Another entry in the Cocoa-based GUI apps was CocoaMySQL, which I used quite a bit before switching to MySQL 4.1. Certain changes in the database security methods that came with 4.1 (explained in this FAQ) have left the application unable to connect to newer servers, although at least one forked version is reportedly available that takes care of the problem.

All of the Above

Which one should you choose? Well, it naturally depends on what kind of user you are, as well as how experienced you are -- but also on what kind of access you have to the database server in question.

All things being equal, I would obtain and learn all of the above. Each has its strengths and weaknesses, yet if you can absorb even a little of all of them, you'll both broaden your MySQL knowledge and add utilities to your toolbelt.

Robert Daeley is a writer and programmer in Southern California. By day he is a mild-mannered server administrator and website developer; by night, in addition to his super-hero duties, he cooks, bikes, hikes, cheers on the Dodgers, and writes fiction.


Return to the Mac DevCenter