MySQL Workbench on OS X

I recently upgraded to a new MacBook Pro, so I’ve been installing all my favorite apps.  When I went to install the MySQL Query Browser, I found that the MySQL Workbench has matured significantly since I last looked at it.  I’m now using it instead.  I’ve got a couple of tips for OS X users.

The UI for MySQL Workbench is fantastic compared to the MySQL Query Browser and the MySQL Administrator.  It looks really polished, and it’s WAY more stable.  The MySQL Workbench FAQ says

MySQL Workbench is a complete rewrite in C++ / C# / Objective-C. Not a single line of code is shared between the projects. But Workbench does build on the experience and feedback got from the DBDesigner4 project and should be better than its predecessor in every respect once GA quality is reached.

The difference between the old MySQL GUI tools and Workbench is night and day.

One thing that took some getting used to is that I can’t directly edit the results of a query (at least not in exactly the same way I used to do it in MySQL Query Browser).  In MQB, you could run a query like

get the results, and immediately start editing the results.  Very convenient.

I noticed when I ran a query in MWB, I have no edit menu or edit toolbar buttons.  How can I edit data?  Over in the schema explorer on the left hand side of the screen, you can expand a list of tables.  You can right-click on one of the tables and choose “Edit Table Data”.  MWB will select a limited number of records and present an editable result set.

That’s fine, but it’s kind of an arbitrary set of records — I believe it’s the first 1000 records in the table.  What if you only want the records from table “foo” where “bar” is greater than 50?

Notice in the query editor, MWB has filled in a SQL query for you:

I wasn’t familiar with the EDIT statement, but it turns out you can construct a query using EDIT just like you would construct a query with SELECT:

You’ll get the desired records in the result set, and you can use the edit buttons on the toolbar to edit your records.

One other quick tip:  in OS X, the “Appearance” preferences tab would not let me change the font used in the SQL editor.  In version 5.2.21 RC, the default font for the editor was set to Andale Mono 10.  That’s a bit tiny for my taste.

You can edit the preferences directly in their XML files.  Shut down MWB.  Then edit the file ~/Library/Application Support/MySQL/Workbench/wb_options.xml.  Look for the key workbench.general.Editor:Font, and change the font there.  Now restart MWB to see your change.




Leave a comment

Your email address will not be published. Required fields are marked *