oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

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


Beyond administration is day-to-day data manipulation. Here are some good options for interacting with your data.


Where MySQL Administrator is an omnipotent admin machine, YourSQL (by Ludit) concentrates on the everyday needs of folks making simple database edits. The simplicity is a bit deceptive, as it can enable power users to get their work done, too.

The Download YourSQL page presents you with a pop-up menu of versions to choose from, which currently lists "1.8.0e development" as the most recent. Unless there's some compelling reason for you to choose the bleeding edge, I would go with "1.7.2", which is the last stable version and which works in Mac OS X 10.3 and newer. Once again, a drag-and-drop is all that stands between download and installation.

YourSQL plays on the familiar Column View in OS X with a Host -> Database -> Table arrangement at the top of the main window. In the bottom half are fields for table design, browsing, and data entry. The overall arrangement is pretty handy, especially if you deal with multiple servers -- visually navigating the hierarchy is a snap.

A toolbar at the very top of the window provides some expected functionality like creating databases, tables, and columns. Deleting things is handled by default either through the menu bar or, if you're in the know, by contextual menus (control- or right-clicks).

One area that could use some improvement is schema design, and you really need to know your varchar from your text before trying to design a table. Assuming you know what you're doing, however, the interface is straightforward. With the working table selected above, add columns below, providing a Type and other definition as necessary. One tip is that you can change Column Types via a submenu under the Schema menu, or via a right-click on the column.

Once you've designed your table's columns, switch to Show Data to begin adding your rows. This part is pretty easily accomplished if you've ever used a spreadsheet, as it's the same idea. A couple of tips: in the very bottom of this area, to the right of the Search field, are two large buttons, one with a photo icon, the other with a text icon. These can be used to enter BLOB images and text blocks a lot more easily than in the small fields above. Also, back in that Search field, the small triangle on the left allows you to choose a particular column to search by.

And if you're truly 1337, head to the next tab, Free-Form SQL, where you can enter raw SQL statements to manipulate your data. There are also Load and Dump commands in the File menu which make it easy to back up data or move tables from one database to another.

YourSQL is best suited for users who are looking for a lightweight MySQL data solution, especially if you have multiple databases on multiple servers. I've used YourSQL to access tables of thousands of rows without making it unusable, although the more data the slower it performs. I wouldn't recommend it for those with slow connections, older computers, overloaded servers, or huge datasets. You may also find some small glitches in UI elements. YourSQL is a GPL open-source project, though, so feel free to head into the source files and play if you're willing and able.


If you're not familiar with phpMyAdmin, add the initials SQL between the My and the Admin, and now you know what it's all about -- PHP-based MySQL administration. It is normally accessed via a web browser interface, and in fact you'll need to have a web server available to run it.

Since you'll be controlling your database on the web, you will need to have a secure setup protecting the phpMyAdmin directory itself. Most of the time, you can use simple Apache htpasswd authentication, but check with your server administrators or ISP for how they want it done. In the case of pre-installations (say, attached to a hosting service), this may be in place already.

Of course, using Mac OS X, you have a web server at your fingertips, simply by turning on Web Sharing under System Preferences. This brings up an important point often missed by users: phpMyAdmin does not need to be installed on the same server as your database. In fact, you could throw it in your local Sites folder for easy access, as long as you configure it with the correct remote login information. There are security considerations with remote administration, however, so ask your admin if you are unsure; they may very well rather you access phpMyAdmin on the same server as your database.

What's important is what your MySQL user account's privileges are, and what host it is allowed to connect from. No matter where you install phpMyAdmin, you'll need to have a MySQL user account on the host you want to edit. This is a different username/password set than the web server login, a distinction sometimes confused by beginners.

Downloading phpMyAdmin will give you a compressed file that expands into a directory with a name matching its version number: e.g., phpMyAdmin-2.7.0, which is the latest as of this writing. You could leave the name alone and just drop it in your web directory, but you also might like to change its name to something easier to type.

Pages: 1, 2, 3

Next Pagearrow