LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Articles > Jeremy's Magazine Articles
User Name
Password

Notices

By jeremy at 2007-05-01 15:02
The MySQL Query Browser
By Jeremy Garcia

Last month's "Tech Support" introduced MySQL Administrator, a powerful, visual administration console that enables you to easily administer your MySQL environment and discover in great detail how your databases are operating. However, MySQL Administrator doesn’t help much with SQL queries.

To craft and run SQL, try the MySQL Query Browser, which, like MySQL Administrator, is available directly from MySQL AB under the same dual-license as MySQL itself. The MySQL Query Browser is a visual tool for creating, executing, and optimizing SQL queries. The application gives you a complete set of drag-and-drop tools to visually build, analyze, and manage your queries. It also provides a number of other powerful features: Use the Query Toolbar to easily create and execute queries and navigate query history; manually create or edit SQL statements with built-in Script Editor; use the Results Window to compare and work with multiple queries; manage your databases, bookmarks, and history using a web browser-like interface in the Object Browser; and select tables and fields to query, and create and delete tables with the Database Explorer and Table Editor.

You can obtain both MySQL Administrator and MySQL Query Browser by downloading the MySQL GUI Tools Bundle from http://dev.mysql.com/downloads/gui-tools/5.0.html. Binaries for all major platforms and source code are available, and binary installation is a snap.

Once you have the software on your system, fire it up and take a look at what it can actually do. To launch the product, type:

$ mysql-query-browser

The first thing you’ll notice on startup is the same credentials window presented by MySQL Administrator, including any stored connections you created previously. Choose a previous connection, enter the appropriate credentials, and hit the Connect button to open the main window.

Near the very top is the query area. This area allows you to manually enter SQL statements or build them visually. Below that and on the left is the results area, which contains output from commands entered in the query area. You’ll notice it acts similarly to a web browser, and even includes full tabbed browsing functionality.

Moving to the right is the Object Browser (on top) and the Information Browser (at bottom). In addition to the capabilities mentioned above, the Object Browser allows you to bookmark common queries and view a history of the queries you’ve run. The Information Browser provides access to all information that is not directly related to actual data within your database, including a syntax reference guide, a full list of built-in MySQL functions, and a list of local, global, and dynamic parameters.

To run a query, choose a "default schema" (a database) by double-clicking a database in the Object Browser. You can also create a new database by right-clicking in the Object Browser and selecting "Create Schema." Once you select a database, you get a full visual layout of the tables and columns. You can manually type SQL queries into the query window, but you can also build them visually.

For instance, to get a full list of rows in a table, double-click the table. The corresponding SQL query is entered for you automatically — you just need to click the Execute button.

Next, drag a table or column from the Object Browser into the query window. This presents a list of actions that can be performed on the item you’ve dragged across. Simply drop the item on the action you'd like to perform to build a complex query piece-by-piece. Once you have a result set you can edit it right in the results window. To do so, simply click the Start Editing button near the bottom and right click on the results you’d like to edit. Creating a new table is similar to creating a new database, simply right click on the database you’d like to alter and select Create Table.

The MySQL Query Browser also gives you access to MySQL's EXPLAIN feature and the ability to compare results. If you're using a newer version of MySQL, the Query Browser also fully supports transactions, views, and stored procedures.

The MySQL query browser is an extremely useful tool for editing MySQL schema and running SQL queries. If you prefer the old school method of manually typing queries, it still provides you the benefit of a clean interface, a full history, and the ability to bookmark oft-run queries. If you’re not a SQL guru, it also allows you to build queries interactively.

by archtoad6 on Thu, 2007-05-03 08:12
Although there is no mention of this on the MySQL site, these packages are available for Debian as:
  • mysql-query-browser
  • mysql-admin

by lord-fu on Tue, 2007-07-17 18:08
I do lke this tool alot, I use it whenever possible. I used to use phpMyadmin but this won me over I guess. Packages for slackware 11 are on linux packages dot net.

http://www.linuxpackages.net/search_...mysql&ver=11.0

by evaluatinglinux on Wed, 2008-10-15 13:20
Thank you Jeremy for the pointer to this article. I've always used Oracle 9i and 10g as my databases. Now - I think I'll give MySQL a shot too!


Debian Kernel


  



All times are GMT -5. The time now is 10:08 AM.

Main Menu

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration