Top Banner
MySQL Workbench
472

MySQL Workbench

Jan 12, 2023

Download

Documents

ISMIATUL RAFIKA
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: MySQL Workbench

MySQL Workbench

Page 2: MySQL Workbench

MySQL Workbench

Abstract

This manual documents the MySQL Workbench SE version 5.2 and the MySQL Workbench OSS version 5.2.

If you have not yet installed MySQL Workbench OSS please download your free copy from the download site. MySQLWorkbench OSS is available for Windows, Mac OS X, and Linux.

Document generated on: 2012-04-27 (revision: 30187)

For legal information, see the Legal Notice.

Page 3: MySQL Workbench

iii

Table of ContentsPreface and Legal Notice ................................................................................................................. vii1. MySQL Workbench Introduction ..................................................................................................... 12. MySQL Workbench Editions ........................................................................................................... 33. Installing and Launching MySQL Workbench ................................................................................... 5

Hardware Requirements ............................................................................................................. 5Software Requirements .............................................................................................................. 5Starting MySQL Workbench ....................................................................................................... 6

Installing MySQL Workbench on Windows .......................................................................... 7Launching MySQL Workbench on Windows ........................................................................ 7Uninstalling MySQL Workbench on Windows ...................................................................... 8Installing MySQL Workbench on Linux ................................................................................ 9Launching MySQL Workbench on Linux ............................................................................. 9Uninstalling MySQL Workbench on Linux ............................................................................ 9Installing MySQL Workbench on Mac OS X ...................................................................... 10Launching MySQL Workbench on Mac OS X .................................................................... 11Uninstalling MySQL Workbench on Mac OS X .................................................................. 11

4. Getting Started Tutorial ................................................................................................................ 13Administering a MySQL Server ................................................................................................. 13Creating a Model ..................................................................................................................... 25Adding Data to Your Database ................................................................................................. 31

5. The Home Window ...................................................................................................................... 35Workbench Central .................................................................................................................. 36Workspace .............................................................................................................................. 37Workbench Application Minimum Window Size .......................................................................... 37Workbench Preferences ........................................................................................................... 37

The General Tab ............................................................................................................. 39The Administrator Tab ...................................................................................................... 39The SQL Editor Tab ........................................................................................................ 39The Model Tab ................................................................................................................ 41The MySQL Tab .............................................................................................................. 42The Diagram Tab ............................................................................................................. 42The Appearance Tab ....................................................................................................... 43

6. SQL Development ........................................................................................................................ 45Open Connection to Start Querying .......................................................................................... 45New Connection ...................................................................................................................... 46Edit Table Data ....................................................................................................................... 46Edit SQL Script ........................................................................................................................ 46Manage Connections ............................................................................................................... 46Manage DB Connections Dialog ............................................................................................... 46

The Password Storage Vault ............................................................................................ 47Standard TCP/IP Connection ............................................................................................ 48Local Socket/Pipe Connection .......................................................................................... 49Standard TCP/IP over SSH Connection ............................................................................ 50

SQL Editor .............................................................................................................................. 50Main Menu ...................................................................................................................... 51Toolbar ............................................................................................................................ 52SQL Query Panel ............................................................................................................ 53Main Tabsheets ............................................................................................................... 54Sidebar ............................................................................................................................ 59

7. Data Modeling ............................................................................................................................. 65Open an Existing EER Model ................................................................................................... 66

Page 4: MySQL Workbench

MySQL Workbench

iv

Create New EER Model ........................................................................................................... 66Create EER Model from Existing Database ............................................................................... 66Create EER Model from SQL Script ......................................................................................... 66Model Editor ............................................................................................................................ 67

Modeling Menus .............................................................................................................. 68The Toolbar ..................................................................................................................... 77EER Diagrams ................................................................................................................. 78The Physical Schemata Panel .......................................................................................... 78The Schema Privileges Panel ........................................................................................... 79The SQL Scripts Panel .................................................................................................... 80The Model Notes Panel ................................................................................................... 80The History Palette .......................................................................................................... 81The Model Navigator Panel .............................................................................................. 81The Catalog Tree Palette ................................................................................................. 81The Layers Palette .......................................................................................................... 82The Properties Palette ..................................................................................................... 82

EER Diagram Editor ................................................................................................................ 83The Vertical Toolbar ........................................................................................................ 83

Working with Models ................................................................................................................ 87Creating Tables ............................................................................................................... 87Creating Foreign Key Relationships ................................................................................ 101Creating Views ............................................................................................................... 105Creating Routines and Routine Groups ........................................................................... 107Creating Layers ............................................................................................................. 110Creating Notes ............................................................................................................... 112Creating Text Objects .................................................................................................... 112Creating Images ............................................................................................................. 113Reverse Engineering ...................................................................................................... 114Forward Engineering ...................................................................................................... 123

Modeling Tutorials .................................................................................................................. 143Importing a Data Definition SQL Script ............................................................................ 144Using the Default Schema .............................................................................................. 145Basic Modeling .............................................................................................................. 147Documenting the sakila Database ............................................................................... 149

Printing .................................................................................................................................. 151Printing Options ............................................................................................................. 151

MySQL Workbench Schema Validation Plugins (Commercial Version) ....................................... 151General Validation .......................................................................................................... 151MySQL-Specific Validation .............................................................................................. 152

The DBDoc Model Reporting Dialog Window (Commercial Version) .......................................... 153Customizing DBDoc Model Reporting Templates ..................................................................... 157

Supported Template Markers .......................................................................................... 161Creating a Custom Template .......................................................................................... 164

8. Server Administration ................................................................................................................. 169Server Administration ............................................................................................................. 169New Server Instance .............................................................................................................. 170Manage Data Import/Export .................................................................................................... 170Manage Security .................................................................................................................... 170Manage Server Instances ....................................................................................................... 170Creating and Managing Server Instances ................................................................................ 170

New Server Instance Wizard .......................................................................................... 170Manage Server Instances Dialog .................................................................................... 173

Server Administration and Configuration .................................................................................. 175The Startup Tab ............................................................................................................. 177

Page 5: MySQL Workbench

MySQL Workbench

v

The Configuration Tab .................................................................................................... 178The Accounts Tab .......................................................................................................... 179The Connections Tab ..................................................................................................... 181The Variables Tab ......................................................................................................... 182The Data Dump Tab ...................................................................................................... 183The Logs Tab ................................................................................................................ 186

9. Extending Workbench ................................................................................................................ 189GRT and Workbench Data Organization ................................................................................. 189Modules ................................................................................................................................. 190Plugins .................................................................................................................................. 191Adding a GUI to a Plugin Using MForms ................................................................................ 192The Workbench Scripting Shell ............................................................................................... 193

Exploring the Workbench Scripting Shell ......................................................................... 193The Shell Window .......................................................................................................... 194The Globals, Classes, and Modules Tabs ....................................................................... 195

Tutorial: Writing Plugins .......................................................................................................... 19510. Keyboard Shortcuts .................................................................................................................. 19911. MySQL Utilities ........................................................................................................................ 203

Introduction ............................................................................................................................ 203Introduction to MySQL Utilities ........................................................................................ 203Connection Parameters .................................................................................................. 204Introduction to extending the MySQL Utilities ................................................................... 205

Commands ............................................................................................................................ 211mysql.utilities.command.grep — Search Databases for Objects ......................................... 211mysql.utilities.command.proc — Search Processes on Servers ......................................... 212

Manual Pages ........................................................................................................................ 214Brief overview of command-line utilities ........................................................................... 214mut - MySQL Utilities Testing ......................................................................................... 216mysqldbcompare - Compare Two Databases and Identify Differences ............................. 218mysqldbcopy - Copy Database Objects Between Servers .............................................. 225mysqldbexport - Export Object Definitions or Data from a Database .............................. 229mysqldbimport - Import Object Definitions or Data into a Database ............................... 236mysqldiff - Identify Differences Among Database Objects ............................................. 239mysqldiskusage - Show Database Disk Usage ............................................................ 243mysqlfailover - Automatic replication health monitoring and failover ............................. 246mysqlindexcheck - Identify Potentially Redundant Table Indexes .................................. 253mysqlmetagrep - Search Database Object Definitions ................................................... 255mysqlprocgrep - Search Server Process Lists .............................................................. 259mysqlreplicate - Set Up and Start Replication Between Two Servers ........................... 262mysqlrpladmin - Administration utility for MySQL replication ......................................... 265mysqlrplcheck - Check Replication Prerequisities ........................................................ 273mysqlrplshow - Show Slaves for Master Server ............................................................ 276mysqlserverclone - Clone Existing Server to Create New Server ................................. 279mysqlserverinfo - Display Common Diagnostic Information from a Server .................... 281mysqluserclone - Clone Existing User to Create New User .......................................... 283

Parsers .................................................................................................................................. 285mysql.utilities.parser — Parse MySQL Log Files .............................................................. 285

A. Third Party Licenses .................................................................................................................. 289.NET Flat TabControl License ................................................................................................. 290ANTLR 3.4 License ................................................................................................................ 290Bitstream Vera License .......................................................................................................... 291Boost Library License ............................................................................................................. 292Cairo License ......................................................................................................................... 292CTemplate (Google Template System) License ....................................................................... 293

Page 6: MySQL Workbench

MySQL Workbench

vi

cURL (libcurl) License ....................................................................................................... 293DockPanel Suite License ........................................................................................................ 294Dojo Toolkit v1.7.0b1 License ................................................................................................. 294GLib License (for MySQL Workbench) .................................................................................... 295Glitz License .......................................................................................................................... 295GNU Lesser General Public License Version 2.1, February 1999 .............................................. 296HtmlRenderer (System.Drawing.Html) ..................................................................................... 304Libiconv License .................................................................................................................... 304Libintl License ........................................................................................................................ 305Libxml2 License ..................................................................................................................... 305Libzip License ........................................................................................................................ 306Lua (liblua) License ................................................................................................................ 306Paramiko License .................................................................................................................. 307PCRE License ....................................................................................................................... 307Pixman License ..................................................................................................................... 308PyCrypto License ................................................................................................................... 310Python License ...................................................................................................................... 310Scintilla License ..................................................................................................................... 320ScintillaNET License .............................................................................................................. 322TinyXML License ................................................................................................................... 322TreeViewAdv for .NET License ............................................................................................... 323VSQLite++ License ................................................................................................................ 323zlib License ........................................................................................................................ 324

B. MySQL Workbench FAQ ............................................................................................................ 327C. MySQL Workbench and Utilities Change History ......................................................................... 329

MySQL Workbench Change History ........................................................................................ 329Changes in Release 5.2 ................................................................................................. 329Changes in Release 5.1 ................................................................................................. 424Changes in Release 5.0 ................................................................................................. 443

MySQL Utilities Change History .............................................................................................. 460Changes in Release 1.0 ................................................................................................. 460

Page 7: MySQL Workbench

vii

Preface and Legal NoticeThis is the User Manual for the MySQL Workbench.

For license information, see the Legal Notice. This product may contain third-party code. For licenseinformation on third-party code, see Appendix A, Third Party Licenses.

Legal Notices

Copyright © 2006, 2012, Oracle and/or its affiliates. All rights reserved.

This software and related documentation are provided under a license agreement containing restrictionson use and disclosure and are protected by intellectual property laws. Except as expressly permittedin your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast,modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by anymeans. Reverse engineering, disassembly, or decompilation of this software, unless required by law forinteroperability, is prohibited.

The information contained herein is subject to change without notice and is not warranted to be error-free.If you find any errors, please report them to us in writing.

If this software or related documentation is delivered to the U.S. Government or anyone licensing it onbehalf of the U.S. Government, the following notice is applicable:

U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation andtechnical data delivered to U.S. Government customers are "commercial computer software" or"commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specificsupplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall besubject to the restrictions and license terms set forth in the applicable Government contract, and, to theextent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19,Commercial Computer Software License (December 2007). Oracle USA, Inc., 500 Oracle Parkway,Redwood City, CA 94065.

This software is developed for general use in a variety of information management applications. It is notdeveloped or intended for use in any inherently dangerous applications, including applications whichmay create a risk of personal injury. If you use this software in dangerous applications, then you shall beresponsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safeuse of this software. Oracle Corporation and its affiliates disclaim any liability for any damages caused byuse of this software in dangerous applications.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. MySQL is a trademark of OracleCorporation and/or its affiliates, and shall not be used without Oracle's express written authorization. Othernames may be trademarks of their respective owners.

This software and documentation may provide access to or information on content, products, and servicesfrom third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim allwarranties of any kind with respect to third-party content, products, and services. Oracle Corporation andits affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use ofthird-party content, products, or services.

This document in any form, software or printed matter, contains proprietary information that is the exclusiveproperty of Oracle. Your access to and use of this material is subject to the terms and conditions of yourOracle Software License and Service Agreement, which has been executed and with which you agreeto comply. This document and information contained herein may not be disclosed, copied, reproduced,or distributed to anyone outside Oracle without prior written consent of Oracle or as specifically provided

Page 8: MySQL Workbench

Legal Notices

viii

below. This document is not part of your license agreement nor can it be incorporated into any contractualagreement with Oracle or its subsidiaries or affiliates.

This documentation is NOT distributed under a GPL license. Use of this documentation is subject to thefollowing terms:

You may create a printed copy of this documentation solely for your own personal use. Conversion to otherformats is allowed as long as the actual content is not altered or edited in any way. You shall not publishor distribute this documentation in any form or on any media, except if you distribute the documentation ina manner similar to how Oracle disseminates it (that is, electronically for download on a Web site with thesoftware) or on a CD-ROM or similar medium, provided however that the documentation is disseminatedtogether with the software on the same medium. Any other use, such as any dissemination of printedcopies or use of this documentation, in whole or in part, in another publication, requires the prior writtenconsent from an authorized representative of Oracle. Oracle and/or its affiliates reserve any and all rightsto this documentation not expressly granted above.

For more information on the terms of this license, or for details on how the MySQL documentation is builtand produced, please visit MySQL Contact & Questions.

For help with using MySQL, please visit either the MySQL Forums or MySQL Mailing Lists where you candiscuss your issues with other MySQL users.

For additional documentation on MySQL products, including translations of the documentation into otherlanguages, and downloadable versions in variety of formats, including HTML and PDF formats, see theMySQL Documentation Library.

Page 9: MySQL Workbench

1

Chapter 1. MySQL Workbench IntroductionMySQL Workbench provides a graphical tool for working with MySQL Servers and databases. MySQLWorkbench fully supports MySQL Server versions 5.1 and above. It is also compatible with MySQL Server5.0, but not every feature of 5.0 may be supported. It does not support MySQL Server versions 4.x.

MySQL Workbench provides three main areas of functionality:

• SQL Development: Enables you to create and manage connections to database servers. As well asenabling you to configure connection parameters, MySQL Workbench provides the capability to executeSQL queries on the database connections using the built-in SQL Editor. This functionality replaces thatpreviously provided by the Query Browser standalone application.

• Data Modeling: Enables you to create models of your database schema graphically, reverse andforward engineer between a schema and a live database, and edit all aspects of your database usingthe comprehensive Table Editor. The Table Editor provides easy-to-use facilities for editing Tables,Columns, Indexes, Triggers, Partitioning, Options, Inserts and Privileges, Routines and Views.

• Server Administration: Enables you to create and administer server instances.

MySQL Workbench is available in two editions, the Community Edition and the Standard Edition. TheCommunity Edition is available free of charge. The Standard Edition provides additional Enterprisefeatures, such as database documentation generation, at low cost.

Page 10: MySQL Workbench

2

Page 11: MySQL Workbench

3

Chapter 2. MySQL Workbench EditionsThe Community Edition (OSS)

The Community Edition is the foundation of all MySQL Workbench editions—versions that are currentlyavailable or those that will become available in the future. All editions of MySQL Workbench are based onthe Community Edition and all future improvements to the base framework and feature set will be includedin this version. The Community Edition is a full feature product that puts a powerful database managementtool into the hands of the MySQL community.

The Standard Edition

The Standard Edition is a commercial extension that builds on top of the OSS Edition and adds modulesand plugins, enabling an optimized work flow. The highlights of this edition are:

• MySQL Specific Schema Validation

• Model Validation

• General Schema Validation

• DBDoc

DBDoc provides the following features:

• Document complex database schemata

• Document all SQL object types

• Document output available in different file formats

A comparison of edition features can be found at MySQL Workbench Developer Central.

Page 12: MySQL Workbench

4

Page 13: MySQL Workbench

5

Chapter 3. Installing and Launching MySQL Workbench

Table of ContentsHardware Requirements ..................................................................................................................... 5Software Requirements ...................................................................................................................... 5Starting MySQL Workbench ............................................................................................................... 6

Installing MySQL Workbench on Windows .................................................................................. 7Launching MySQL Workbench on Windows ................................................................................ 7Uninstalling MySQL Workbench on Windows .............................................................................. 8Installing MySQL Workbench on Linux ........................................................................................ 9Launching MySQL Workbench on Linux ..................................................................................... 9Uninstalling MySQL Workbench on Linux .................................................................................... 9Installing MySQL Workbench on Mac OS X .............................................................................. 10Launching MySQL Workbench on Mac OS X ............................................................................ 11Uninstalling MySQL Workbench on Mac OS X .......................................................................... 11

MySQL Workbench is available for the following platforms:

• Windows

• Linux

• Mac OS X

Binary distributions of MySQL Workbench are available for the preceding platforms. Source codedistributions are also available as a tar.gz package or an RPM package.

The following sections explain the installation process for each of these platforms.

Hardware RequirementsMySQL Workbench requires a system that runs smoothly. The minimum hardware requirements are:

• CPU: 32-bit or 64-bit

• Cores: Single (Single Core 3GHz or higher, Dual Core 2GHz or higher recommended)

• RAM: 4 GB (6 GB or higher recommended)

• Graphic Accelerators: nVidia or ATI with support of OpenGL 2 or higher

• Display Resolution: 1280×1024 minimum (1920×1200 or higher recommended)

Software RequirementsThe following operating systems are officially supported:

• Apple Mac OS X v10.6.1+ (32-bit/64-bit)

• Fedora 15 (32-bit/64-bit)

• Microsoft Windows 7 (32-bit/64-bit)

• Oracle Linux 6 (32-bit/64-bit)

Page 14: MySQL Workbench

Starting MySQL Workbench

6

• Ubuntu 10.04 LTS (32-bit/64-bit)

• Ubuntu 11.04 (32-bit/64-bit)

MySQL Workbench also has the following general requirements:

Note

On startup, the application checks the OpenGL version and chooses betweensoftware and hardware rendering. To determine which rendering method is beingused, open the Help menu and choose the System Info item.

Requirements for Linux:

• The requirements for Linux are embedded within their respective packages. Use the platform specifictool (for example, yum or apt) to install the package and their dependencies.

Requirements for Microsoft Windows:

• Microsoft .NET 4.0 Framework

• Microsoft Visual C++ 2010 Redistributable Package (x86)

Note

For convenience, the Windows libraries are available as the download“Dependencies for Compiling in Windows”.

Starting MySQL Workbench

The procedure for launching MySQL Workbench depends on the platform. Generally, there are two waysto launch MySQL Workbench: either from the command line or from the graphical user interface of the hostoperating system. Using the command-line launching facility is useful when you want to customize someaspects of the way MySQL Workbench operates. The following sections describe how to launch MySQLWorkbench for each of the supported platforms.

In addition to platform-specific command-line options, MySQL Workbench has the following command-lineoptions:

• --log-level level: Controls the verbosity level for logging output from Workbench.

With increasingly levels of verbosity, the valid values for level are: error, warning, info, debug1,debug2, and debug3.

The location of the generated log files are as follows: Linux: ~/.mysql/workbench/log/wb.log,Mac: ~/Library/Application Support/Workbench/log/wb.log, and on Windows: C:\Users\[your user id]\AppData\Roaming\MySQL\Workbench\wb.log

• --admin instance: Load the server instance specified.

• --query connection: Load the connection specified.

• --model modelfile: Load the model specified.

• --script script: Run the script specified.

• --run code: Run the code snippet specified.

Page 15: MySQL Workbench

Installing MySQL Workbench on Windows

7

• --quit-when-done: Quits MySQL Workbench after --script or --run finishes.

Installing MySQL Workbench on Windows

MySQL Workbench for Windows can be installed using the Windows Installer package or installedmanually from a Zip file.

Important

Installing MySQL Workbench using the Installer package requires eitherAdministrator or Power User privileges. If you are using the Zip file without aninstaller, you do not need Administrator or Power User privileges.

Installing MySQL Workbench Using the Installer Package

MySQL Workbench can be installed using the Windows Installer (.msi) installation package. The MSIpackage bears the name mysql-workbench-version-win32.msi, where version indicates theMySQL Workbench version number.

Improving the MySQL Installation Wizard depends on the support and feedback of users. If you find thatthe MySQL Installation Wizard lacks some feature important to you, or if you discover a bug, please reportit in our bugs database. Select the Report a Bug item from the Help menu.

1. To install MySQL Workbench, right-click the MSI file and select the Install item from the pop-up menu,or double-click the file.

2. In the Setup Type window you may choose a Complete or Custom installation. To use all features ofMySQL Workbench choose the Complete option.

3. Unless you choose otherwise, MySQL Workbench is installed in C:\%PROGRAMFILES%\MySQL\MySQL Workbench 5.1 edition_type\, where %PROGRAMFILES% is the default directoryfor programs for your locale. The %PROGRAMFILES% directory may be C:\Program Files or C:\programme.

Installing from the Zip File

If you have problems running the Installer package, an alternative is to install from a Zip file without aninstaller. That file is called mysql-workbench-version-win32.zip.

To install using the Zip file, download the Zip file to a convenient location and decompress the file using aZip utility. You can place the resulting directory anywhere on you system. You need not install or configurethe application before using it. You may want to create a shortcut on your desktop or the quick launch bar.

Launching MySQL Workbench on Windows

To start MySQL Workbench on Windows, select Start, Programs, MySQL, then select MySQL Workbench.

Alternatively, start MySQL Workbench from the command line. To view the available command-lineoptions, issue the command MySQLWorkbench -help | more from the MySQL Workbench installationdirectory. You will see the following output:

MySQL Workbench 5.2.34 SE. (C) 2006-2011 by Oracle Corporation.All rights reserved.

Usage: MySQLWorkbench [options] [model file]

Options -admin instance .... Open an admin tab to the named server instance at startup -open filename ..... Open the given filename at startup

Page 16: MySQL Workbench

Uninstalling MySQL Workbench on Windows

8

-query server ...... Open a DB query tab to the named server connection at startup -run script ........ Executes the given Workbench script at startup -run-python script . Executes the given Workbench Python script at startup -run-lua script .... Executes the given Workbench Lua script at startup -script scriptfile . Executes the given Workbench script file at startup -quit-when-done .... Quits Workbench once the given script finishes executing -swrendering ....... Force the canvas to use software rendering instead of OpenGL -nologo ............ Do not display the splash screen -log ............... Instruction to save messages (other debug info) to file -verbose (-v) ...... Print verbose output in the GRT Shell -version ........... Print the version information -grtversion ........ Print the GRT version information -help (-h) ......... Print this output

The MySQL Workbench help output includes a version number, a usage message, and the optiondescriptions. Use the -swrendering option if your video card does not support OpenGL 1.5. The -version option can be used to display the MySQL Workbench version number. The -grtversioncan be used to display the GRT (Generic RunTime) shell version number. The other options are self-explanatory.

Note

When using the -help and -version, command-line options that display outputto a console window, be sure that you pipe the output through the more command.Otherwise, nothing will be displayed.

Uninstalling MySQL Workbench on Windows

The method for uninstalling MySQL Workbench depends on how you installed MySQL Workbench in thefirst place.

Removing MySQL Workbench After Installation Using the Installer Package

1. To uninstall MySQL Workbench, open the Control Panel and Choose Add or Remove Programs.Find the MySQL Workbench entry and choose the Remove button. This will remove MySQLWorkbench.

2. Any modules added to the C:\%PROGRAMFILES%\MySQL\MySQL Workbench version\modulesdirectory will not be deleted.

Note

If you installed MySQL Workbench using the Installer package, it is not possible toremove MySQL Workbench from the command line. Although you can manuallyremove some of the components, there is no command-line option for removingMySQL Workbench.

Removing the MySQL Workbench directory manually will not remove all the filesbelonging to MySQL Workbench.

Removing MySQL Workbench After Installation from a Zip File

To remove MySQL Workbench, just delete the MySQL Workbench directory.

Note

If you installed any additional modules within the modules directory and you wantto keep them, make sure you copy those modules to a different directory beforedeleting the MySQL Workbench directory.

Page 17: MySQL Workbench

Installing MySQL Workbench on Linux

9

Installing MySQL Workbench on Linux

There are binary distributions of MySQL Workbench available for several variants of Linux, includingFedora, Oracle Linux, and Ubuntu.

In addition to the binary distributions, it is also possible to download the MySQL Workbench source codeas a tar.gz or RPM package.

Check the MySQL Workbench download page for the latest packages.

The procedure for installing on Linux depends on which Linux distribution you are using.

Installing DEB packages

On Ubuntu, and other systems that use the Debian package scheme, you can install MySQL Workbenchusing a command such as:

shell> sudo dpkg -i package.deb

package.deb is the MySQL Workbench package name; for example, mysql-workbench-oss-version_i386.deb, where version is the MySQL Workbench version number.

Note

You may be warned that certain libraries are not available, depending on whatyou already have installed. Install the required libraries and then install the MySQLWorkbench package again.

Installing RPM packages

On Red Hat-based systems, and other systems that use the RPM package format, MySQL Workbench canbe installed by a command such as:

shell> sudo rpm -i package.rpm

package.rpm is the MySQL Workbench package name; for example, mysql-workbench-oss-version-1fc10.x86_64.rpm, where version is the MySQL Workbench version number.

Launching MySQL Workbench on Linux

After MySQL Workbench has been installed, it can be launched by selecting Applications, Programming,MySQL Workbench from the main menu.

MySQL Workbench can also be launched from the command line on Linux. Type the command:

shell> /usr/bin/mysql-workbench --help

This will display the available command-line options:

mysql-workbench [<options>] [<model file>]Options: --force-sw-render Force Xlib rendering --force-opengl-render Force OpenGL rendering --help, -h Show command line options and exit

Uninstalling MySQL Workbench on Linux

The procedure for uninstalling MySQL Workbench on Linux depends on the package you are using.

Uninstalling DEB packages

To uninstall a Debian package, use this command:

Page 18: MySQL Workbench

Installing MySQL Workbench on Mac OS X

10

shell> sudo dpkg -r mysql-workbench-oss

This command does not remove the configuration files. If you wish to also remove the configuration files,use this command:

shell> sudo dpkg --purge mysql-workbench-oss

Uninstalling RPM packages

To uninstall an RPM package, use this command:

shell> sudo rpm -e mysql-workbench-oss

This command does not remove the configuration files.

Installing MySQL Workbench on Mac OS X

MySQL Workbench for Mac OS X is distributed as a DMG file. The file is named mysql-workbench-oss-version-osx10.5-i686.dmg, where version is the MySQL Workbench version.

To install MySQL Workbench on Mac OS X, download the file. Double-click the downloaded file. You willbe presented with the installation window.

Figure 3.1. MySQL Workbench Mac OS X Installation Window

Page 19: MySQL Workbench

Launching MySQL Workbench on Mac OS X

11

Drag the MySQL Workbench icon onto the Applications icon as instructed. MySQL Workbench is nowinstalled.

You can now launch MySQL Workbench from the Applications folder.

Launching MySQL Workbench on Mac OS X

To launch MySQL Workbench on Mac OS X, open the Applications folder in the Finder, then double-clickMySQL Workbench.

It is also possible to start MySQL Workbench from the command line:

shell> open MySQLWorkbench.app model_file

A model file must be specified.

Uninstalling MySQL Workbench on Mac OS X

To uninstall MySQL Workbench for Mac OS X, locate MySQL Workbench in the Applications folder, right-click, and select Move to Trash.

Page 20: MySQL Workbench

12

Page 21: MySQL Workbench

13

Chapter 4. Getting Started Tutorial

Table of ContentsAdministering a MySQL Server ......................................................................................................... 13Creating a Model ............................................................................................................................. 25Adding Data to Your Database ......................................................................................................... 31

This tutorial provides a quick hands-on introduction to using MySQL Workbench for beginners. If you haveused MySQL Workbench before you can safely skip this tutorial.

This tutorial uses a locally installed MySQL Server. If you only have access to a remote MySQL server,you must enter appropriate connection parameters as necessary. This tutorial requires MySQL Workbench5.2.16 or above. It is assumed that you have a basic understanding of MySQL concepts. This tutorialdemonstrates the procedures on Microsoft Windows, but they are the same for all supported platforms.

Administering a MySQL Server

In this section, you will use MySQL Workbench to carry out administrative functions, such as starting andstopping the server.

1. Launch MySQL Workbench. You will be presented with the Home window.

Page 22: MySQL Workbench

Administering a MySQL Server

14

Figure 4.1. Getting Started Tutorial - Home Window

2. To administer your MySQL Server, you must first create a Server Instance. The instance containsinformation about the target server, including how to connect to it. From the MySQL WorkbenchHome window, click New Server Instance. The Create New Server Instance Profile wizard will bedisplayed.

3. In this tutorial, you will connect to a locally installed server, so click Next.

Page 23: MySQL Workbench

Administering a MySQL Server

15

Figure 4.2. Getting Started Tutorial - Specify Host Machine

4. Next you will set up a connection, or select an existing connection to use to connect to the server.Assuming that you have not already created a connection, you can use the default values here,although if your MySQL Server has a password set for the root account, you can enter it here byclicking Store in Vault. This enables you to connect to the server without needing to enter a passwordeach time. It is also possible to use a different account to connect to the server by setting the username and password here, if required.

Page 24: MySQL Workbench

Administering a MySQL Server

16

Figure 4.3. Getting Started Tutorial - Database Connection

You can now click Next.

5. The connection will now be tested. You should see that the connection was successful. If not click Backand check that you have entered the information required.

Page 25: MySQL Workbench

Administering a MySQL Server

17

Figure 4.4. Getting Started Tutorial - Connection Test

If the connection test was successful, click Next.

6. Optionally, you may configure a method for remote management if a Remote Host was specified.Setting these options enables MySQL Workbench to determine the location of configuration files, andthe correct start and stop commands to use for the server.

SSH login based management and Native Windows remote management types are available. TheOperating System and MySQL Installation Type are configured for the SSH login variant.

Page 26: MySQL Workbench

Administering a MySQL Server

18

Figure 4.5. Getting Started Tutorial - Management and OS

Set the configuration method, then click Next.

7. If the SSH login based management was chosen, then you will configure its parameters which includesthe User Name, Host Name, and optionally the SSH key for authentication.

Page 27: MySQL Workbench

Administering a MySQL Server

19

Figure 4.6. Getting Started Tutorial - SSH Configuration

Check that everything is in order, then click Next.

8. If a Windows server is used, then the Windows configuration parameters must be set.

Page 28: MySQL Workbench

Administering a MySQL Server

20

Figure 4.7. Getting Started Tutorial - Windows Management

Check that everything is in order, then click Next.

9. The wizard will now check that it is able to access the MySQL Server configuration file, and access thestart and stop commands.

Page 29: MySQL Workbench

Administering a MySQL Server

21

Figure 4.8. Getting Started Tutorial - Test Host Settings

Check that everything is in order, then click Next.

10. You now have a chance to review the configuration settings so far. The information displayed variesslightly depending on platform, connection method and installation type.

Page 30: MySQL Workbench

Administering a MySQL Server

22

Figure 4.9. Getting Started Tutorial - Review Settings

Review the information, then click Next.

11. Finally you can give the server instance a suitable name. This will be used to select this particularinstance from a list of available instances.

Page 31: MySQL Workbench

Administering a MySQL Server

23

Figure 4.10. Getting Started Tutorial - Instance Name

Set the desired name, then click Finish to complete the server instance creation process.

12. You will now be returned to the Home window. You will see the new server instance you created, alongwith the new connection you created as part of the preceding procedure.

Page 32: MySQL Workbench

Administering a MySQL Server

24

Figure 4.11. Getting Started Tutorial - Home Window Instance

You are now ready to test your new server instance.

13. From the Home window, double-click the Server Instance you created. The Administrator will open onthe Startup configuration page.

Page 33: MySQL Workbench

Creating a Model

25

Figure 4.12. Getting Started Tutorial - Admin Startup

14. Click the Stop Server button. The message window will show that the server has stopped.

15. Click the Start Server button to resume the server. The message window will confirm that the server isrunning.

You have now seen how to create a server instance to enable you to manage a MySQL server.

For further information, see Chapter 8, Server Administration.

Creating a Model

In this section, you will learn how to create a new database model, create a table, create an EER Diagramof your model, and then forward engineer your model to the live database server.

1. Start MySQL Workbench. On the Home window, select Create new EER Model. A model can containmultiple schemata. Note that when you create a new model, it contains the mydb schema by default.You can change the name of this schema to serve your own purposes, or delete it.

Page 34: MySQL Workbench

Creating a Model

26

Figure 4.13. Getting Started Tutorial - Home Window

2. On the Physical Schemata toolbar, click the button + to add a new schema. This will create a newschema and display a tabsheet for the schema. In the tabsheet, change the name of the schemato “dvd_collection”, by typing into the field called Name. Ensure that this change is reflected on thePhysical Schemata tab. Now you are ready to add a table to your schema.

Page 35: MySQL Workbench

Creating a Model

27

Figure 4.14. Getting Started Tutorial - New Schema

3. In the Physical Schemata section, double-click Add Table.

4. This will automatically load the table editor, with the default table name being table1. In the table editor,change the name of the table from “table1” to “movies”.

5. Next, add several columns. Double click a cell within the Column Name column, and the first fieldwill default to “moviesid” because MySQL Workbench appends “id” to the table name as the defaultfor the initial field. Change the name to “movie_id” and keep the Datatype as INT. Then, be sure PK(PRIMARY KEY), NN (NOT NULL), and AI (AUTO_INCREMENT) are all checked.

6. Add two additional columns using the same method as described above:

Column Name Data Type Column Properties

movie_title VARCHAR(45) NN

release_date DATE (YYYY-MM-DD) None

Page 36: MySQL Workbench

Creating a Model

28

Figure 4.15. Getting Started Tutorial - Columns

7. Now you can obtain a visual representation of this schema so far. From the main menu, select Model,Create Diagram from Catalog Objects. The EER Diagram will be created and displayed.

Page 37: MySQL Workbench

Creating a Model

29

Figure 4.16. Getting Started Tutorial - EER Diagram

8. In the table editor, change the name of the column “movie_title” to “title”. Note that the EER Diagram isautomatically updated to reflect this change.

9. At this point, you can save your model. Click the main toolbar button Save Model to CurrentFile. You have not yet saved this file so you will be prompted to enter a model file name. For thistutorial, enter “Home_Media”. The Home_Media model may contain further schemata in addition todvd_collection, such as cd_collection. Click Save to save the model.

10. You can synchronize your model with the live database server. First, you must tell MySQL Workbenchhow to connect to the live server. From the main menu, select Database, Manage Connections....

11. In the Manage DB Connections dialog, click New.

12. Enter “Big Iron Server” for the connection name. This enables you to identify the server to which thisconnection corresponds, although it is possible to create multiple connections to the same server.

13. Enter the user name for the account you will use to connect to the server.

14. Click on the Store in Vault... button and enter the password for the user name you entered in theprevious step. You can optionally ignore this step, and you will be prompted for this passwordwhenever MySQL Workbench connects to the server.

15. Click Test Connection to test your connection parameters. If everything is okay at this point, you canclick Close.

Page 38: MySQL Workbench

Creating a Model

30

Figure 4.17. Getting Started Tutorial - Manage Connections

16. You are now ready to forward engineer your model to the live server. From the main menu, selectDatabase, Forward Engineer.... The Forward Engineer to Database wizard will be displayed.

17. The Options page of the wizard shows various advanced options. For this tutorial, you can ignore theseand simply click Next.

18. On the next page, you can select the object you want to export to the live server. In this case, you onlyhave a table, so no other objects need be selected. Click Next.

19. The next page, Review SQL Script, displays the script that will be run on the live server to create yourschema. Review the script to make sure that you understand the operations that will be carried out.Click Next.

Page 39: MySQL Workbench

Adding Data to Your Database

31

Figure 4.18. Getting Started Tutorial - Review Script

20. Select the connection you created earlier, “Big Iron Server”. Click Execute. Check the messages forany errors, then click Close to exit the wizard.

21. Ensure that the script ran without error on the server, then click Close. As a simple test that the scriptworked launch the MySQL Command Line Client (mysql). Enter SHOW DATABASES; and identify yourschema. Enter USE dvd_collection; to select your schema. Now enter SHOW TABLES;. EnterSELECT * FROM movies;, this will return the empty set as you have not yet entered any data intoyour database. Note that it is possible to use MySQL Workbench to carry out such checks, and youwill see how to do this later, but the MySQL Command Line Client has been used here as you haveprobably used it previously.

22. Ensure that your model is saved. Click Save Model to Current File on the main toolbar.

Adding Data to Your Database

In the previous section, you created a model, schema, and table. You also forward engineered your modelto the live server. In this section, you will see how you can use MySQL Workbench to add data into yourdatabase on the live server.

1. On the Home window, click the link Edit Table Data in the SQL Development area of the Workspace.This launches Edit Table Data wizard.

Page 40: MySQL Workbench

Adding Data to Your Database

32

Figure 4.19. Getting Started Tutorial - Edit Table Data

2. In the wizard, select the “Big Iron Server” connection from the stored connection list. Click Next.

3. Select the schema, dvd_collection. Select the table to edit, movies. Click Finish.

4. You will see a data grid. This is where you can enter the data for your database. Remember that themovie_id was set to be autoincrement, so you need not enter values directly for this column. In thedata grid, enter the movie information shown in the following table.

title release_date

Gone with the Wind 1939-04-17

The Hound of the Baskervilles 1939-03-31

The Matrix 1999-06-11

Above the Law 1988-04-08

Note

Do not modify any values in the movie_id column.

5. Now click the Apply button in the toolbar located in the bottom right corner. A list of SQL statements willbe displayed. Confirm that you understand the operations to be carried out. Click Apply to apply thesechanges to the live server.

6. Confirm that the script was executed correctly, then click Finish.

Page 41: MySQL Workbench

Adding Data to Your Database

33

7. View the data grid again and observe that the autoincrement values have been generated.

Figure 4.20. Getting Started Tutorial - Edit Data

8. Now you will check that the data really has been applied to the live server. Launch the MySQLCommand Line Client. Enter SELECT * FROM movies; to see the data just entered.

9. You can also carry out a similar check from within MySQL Workbench. Click on the Home window tab.

10. Click the link Open Connection to start Querying in the SQL Development section of the Workspace.This will launch the Connect to Database dialog. Select “Big Iron Server” from the list. Click OK.

11. A new SQL Editor tab will be displayed. In the SQL Statements area, enter the following code:

USE dvd_collection;SELECT * FROM movies;

12. Now click the Execute toolbar button. This resembles a small lightning bolt. The SQL Editor will displaya new Result tab contain the result of executing the SQL statements.

Page 42: MySQL Workbench

Adding Data to Your Database

34

Figure 4.21. Getting Started Tutorial - Results

In this section of the tutorial, you have learned how to add data to your database, and also how to executeSQL statements using MySQL Workbench.

Page 43: MySQL Workbench

35

Chapter 5. The Home Window

Table of ContentsWorkbench Central .......................................................................................................................... 36Workspace ...................................................................................................................................... 37Workbench Application Minimum Window Size .................................................................................. 37Workbench Preferences ................................................................................................................... 37

The General Tab ..................................................................................................................... 39The Administrator Tab .............................................................................................................. 39The SQL Editor Tab ................................................................................................................ 39The Model Tab ........................................................................................................................ 41The MySQL Tab ...................................................................................................................... 42The Diagram Tab .................................................................................................................... 42The Appearance Tab ............................................................................................................... 43

When MySQL Workbench first starts, it presents the Home window, which has two main sections:

• Workbench Central

• Workspace

Note

MySQL Workbench 5.2 introduced the Home window. MySQL Workbench 5.1displays the MySQL Model workspace rather than the Home window. Note that 5.1does not support the SQL Editor and Server Administration functionality of 5.2.

The two sections can be seen in the following screenshot. For more information, see the following sections.

Page 44: MySQL Workbench

Workbench Central

36

Figure 5.1. The Home Window

Workbench Central

Workbench Central enables you to keep up to date with MySQL Workbench news, events, and resources.You can read the developer blogs, find out what's new in the release, access the forums, check forupdates, and file a bug report.

Workbench Central includes the following facilities:

• What's new: A list of bug fixes and changes

• MySQL Doc Library: Built-in documentation

• MySQL Bug Reporter: Links to the MySQL bug system, where you can report bugs

Page 45: MySQL Workbench

Workspace

37

• Workbench Team Blog: Links to the Workbench team blog

• Planet MySQL: Links to MySQL-related blogs and news

• Workbench forums: Links to the MySQL user and developer forums

Workspace

The Workspace is designed to enable you to quickly get to the task you would like to carry out. Inalignment with MySQL Workbench functionality, it is divided into three main areas:

• SQL Development. For further information, see Chapter 6, SQL Development.

• Data Modeling. For further information, see Chapter 7, Data Modeling.

• Server Administration. For further information, see Chapter 8, Server Administration.

Workbench Application Minimum Window Size

As of version 5.2.10, the MySQL Workbench application features a fixed minimum window size of1024x768. You cannot reduce the size of the application to less than this resolution.

Workbench Preferences

The Preferences menu sets MySQL Workbench defaults. Choosing this menu item opens the followingdialog box.

Page 46: MySQL Workbench

Workbench Preferences

38

Figure 5.2. The Preferences Dialog Box

The preferences dialog box contains the following tabs:

• General: Configuration of general-purpose options

• Administrator: Configuration of tools used by the Administrator functionality

• SQL Editor: Configuration of the SQL Editor

• Model: Default object names

• MySQL: Configuration of the default storage engine

• Diagram: EER diagram settings

• Appearance: Change colors and fonts used by various Workbench components

A more detailed discussion of these options follows.

Page 47: MySQL Workbench

The General Tab

39

The General Tab

The General tab enables you to set the following options:

• Automatically Reopen Previous Model When Started: Check this if you want the model on which youpreviously worked to be automatically reopened when you start MySQL Workbench.

• Place Sidebar on the Right Side: By default, the Sidebar is placed on the left-hand side of the MySQLWorkbench application. Select this option to place it on the right-hand side.

• Force use of software rendering for EER diagrams: MySQL Workbench will use OpenGL forrendering when available. However, due to faulty drivers, problems do occasionally occur. These issuescan be resolved by selecting the software rendering option here.

• Undo History Size: You can limit the size of the undo history here. Set this value to 0 to have anunlimited undo history.

• Auto-save model interval: An open model that has not been saved will automatically be saved afterthis period. On loading a model file, MySQL Workbench will notify the user if the file was not previouslysaved correctly, due to a crash or power failure. MySQL Workbench can then attempt to recover the lastauto-saved version. For automatic recovery to be available for a new file, it will have to have been savedat least once by the user.

• Interactive GRT Shell Language: You can select the language to be used in the GRT (GenericRunTime) shell by choosing a language from the list Interactive GRT Shell Language. Currently, thechoices are Lua and Python. Python is the recommended option.

The Administrator Tab

This section provides configuration options that affect the Administrator functionality in MySQL Workbench.It enables you to set paths to the mysqldump and mysql tools. If these paths are left blank, the defaultsare used. This panel also enables you to set the directory for export dump files.

The SQL Editor Tab

This section provides configuration options that affect the SQL Editor functionality in MySQL Workbench.

There are three main groups of parameters that can be set here:

• SQL properties

• Query Editor

• Query Results

SQL Properties

SQL properties that can be set include the SQL_MODE, case sensitivity of identifiers, and the SQL delimiterused.

The document property SqlMode defines SQL_MODE for all operations affecting SQL parsing at thedocument scope. The purpose of this option is to preserve the consistency of SQL statements within thedocument.

The property has the following functions:

Page 48: MySQL Workbench

The SQL Editor Tab

40

• Sets the SQL_MODE DBMS session variable to the value stored in the SqlMode property of thedocument when performing reverse engineering, forward engineering, or synchronization operations.

• Honors the SQL_MODE values defined in SqlMode so that SQL parsing is correct.

Only a subset of all possible SQL_MODE values affect the MySQL Workbench SQL parser. Thesevalues are: ANSI_QUOTES, HIGH_NOT_PRECEDENCE, IGNORE_SPACE, NO_BACKSLASH_ESCAPES,PIPES_AS_CONCAT. Other values do not affect the MySQL Workbench SQL parser and are ignored.

If the value of SqlMode is not set, the default value of the SQL_MODE session variable defined bythe server stays unchanged during operations with the server. However, the MySQL WorkbenchSQL parser behaves as if SQL_MODE is also not set. This may potentially lead to inconsistencies inparsing of SQL statements stored in the document. If you choose to not set the SqlMode property,ensure that the default SQL_MODE variable defined by the server does not contain any values from thefollowing list: ANSI_QUOTES, HIGH_NOT_PRECEDENCE, IGNORE_SPACE, NO_BACKSLASH_ESCAPES,PIPES_AS_CONCAT.

The SqlMode property is defined in two locations: globally and at document scope. MySQL Workbenchuses the global property to initialize the document property for each new document created. For eachdocument, the property value defined at document scope always has higher priority over the one definedglobally.

Query Editor

The query editor properties that can be set include the following:

• Show Live Schema Overview: This option enables a simplification of the user interface by removing theOverview tab from the SQL Editor. This is extremely useful if schemata have a large number of tables, ora model has a large number of schemata. In each of these cases, load times would be greatly increasedas the tables and schemata are enumerated and drawn.

• Show Schema Contents in Schema Tree: Enumerating, populating, and drawing large numbers ofitems can significantly increase loading times. For this reason, this facility can be switched off for modelscontaining large numbers of schemata and tables.

• Show Metadata Schemata: By default metadata schemata are not displayed. To display them, forexample to troubleshoot or check metadata information, select this option.

• Continue on SQL Script Error: Should an error occur while executing a script, this option causesexecution to continue for the remainder of the script.

• Forbid UPDATE and DELETE statements without a WHERE clause: This option enables theSQL_SAFE_UPDATES option for the session, preventing UPDATE and DELETE statements from beingexecuted if a WHERE clause is not present. This can avoid potentially dangerous situations where astatement could accidentally update or delete all rows in a table.

• Max syntax error count: Large complex scripts can contain many errors. Further, a syntax error earlyon can lead to many subsequent syntax errors. For these reasons, it is possible to limit the number oferrors displayed using this option. The default is 100 error messages.

• Progress status update interval: When executing long running queries over a slow connection, youmay need to increase this value to prevent excess load on the connection.

• DBMS connection keep-alive interval: When executing long running queries over a slow connection,you may need to increase this value to prevent the connection being lost.

Query Results

Page 49: MySQL Workbench

The Model Tab

41

The query results properties that can be set include the following:

• Limit Rows: Queries can sometimes return an excessive number of rows, which can heavily loadthe connection, and take time to display in MySQL Workbench. To prevent this, you can set a moremoderate value here.

• Limit Rows Count: Specify the maximum number of result rows to return.

• Max. Field Value Length to Display: To avoid display problems due to excessive field length, it ispossible to set the maximum field length to display (in bytes).

• Treat BINARY/VARBINARY as non-binary character string: Binary byte string values are notdisplayed by default in the results grid, but are instead marked as BLOB values. These can then beviewed or edited with the BLOB editor. Nonbinary character string values are displayed in the results grid,and can be edited in the grid cell or using the BLOB editor.

If this option is turned on, data truncation may result: Binary byte string values may contain null bytes aspart of their valid data, whereas for nonbinary character strings, a null byte terminates the string.

• Enable Data Changes Commit Wizard: In the SQL Editor, if you edit table data and then click theApplying changes to data button, MySQL Workbench launches a wizard to step you through applyingyour changes. This gives you a chance to review the SQL that will be applied to the live server to makethe requested changes. If this option is deselected, the changes will be applied to the server without thewizard being displayed and without giving you a chance to review the changes that will be made.

The Model Tab

This section provides configuration options that affect the Modeling functionality in MySQL Workbench.

Use the When Deleting Physical Model Figures in Diagram section to determine the behavior whendeleting objects from the EER diagram canvas. Choose Ask and whenever you delete an object, you willbe asked whether you wish to remove the object from an EER diagram only or also from the catalog. TheKeep Database Object in Catalog is the safest option. You also have the option of deleting theobject from both the EER diagram and the catalog.

Note

If you choose the Ask option, a confirmation dialog box opens only when you aredeleting an object from an EER Diagram. When deleting in the MySQL Model view,there is no confirmation dialog window and the delete action always removes theobject from the catalog.

There are a variety of ways to delete an object from an EER canvas: using the eraser tool; choosing apop-up menu item; using the delete key; and by choosing the delete option from the Edit menu. In eachcase, the action performed by the delete key is determined by the option chosen from the When DeletingPhysical Model Figures in Diagram section.

Use the Model tab to set the default value for various object names and the primary key data type. Thefollowing table shows the object names and their default values.

Object Name Default Value

Primary Key Column Name id%table%

Primary Key Column Type INT

Column Name %table%col

Page 50: MySQL Workbench

The MySQL Tab

42

Object Name Default Value

Column Type VARCHAR(45)

Foreign Key Name fk%stable_%dtable%

Foreign Key Column Name %table%_%column%

ON UPDATE NO ACTION

ON DELETE NO ACTION

Associative Table Name %stable%_has_%dtable%

The Primary Key Column Name Primary Key Column Type, Column Name, and Column Typevalues are the defaults used by the table editor. The others are the default names used when using therelationship tools on an EER diagram.

Within object values items enclosed by percentage signs are variables. Their meanings are as follows:

• %table%: The table associated with the object

• %stable%: The source table associated with the object

• %dtable%: The destination table associated with the object

• %column%: The column associated with the object

Legitimate values for the foreign key update or delete rules are:

• RESTRICT

• CASCADE

• SET NULL

• NO ACTION (default)

For more information about these actions, see The Foreign Keys Tab.

The MySQL Tab

This enables you to set the default table storage engine.

The Diagram Tab

Use this tab to determine display settings for an EER diagram.

Select whether to expand new objects by checking the Expand New Objects check box and selectwhether to draw line crossings by checking the Draw Line Crossings check box.

This tab also enables you to set the maximum number of characters for the following items:

• Column Names

• Column Types

• Routine Names

Changes to these values change the display properties only, not the objects themselves.

Page 51: MySQL Workbench

The Appearance Tab

43

The Appearance Tab

Use this tab to set the available colors for the objects that appear on an EER diagram canvas. You canalso add colors if you wish.

Changes made here affect the list of colors that appears on the toolbar when adding objects to an EERdiagram canvas. For information about using this list, see Tool-Specific Toolbar Items.

You can also use this tab to set the font face, size, and style for the following items:

• Editor

• Layer Title

• Text Figure Text

• Text Figure Title

• Connection Caption

• Routine Group Figure Item

• Routine Group Figure Title

• Table Figure Items

• Table Figure Section

• Table Figure Title

• View Figure Title

Note

On Windows, the default font for the editor supports only latin-1 characters. Ifyou need to use characters not supported by the latin-1 character set, you mustchange the font here.

Page 52: MySQL Workbench

44

Page 53: MySQL Workbench

45

Chapter 6. SQL Development

Table of ContentsOpen Connection to Start Querying .................................................................................................. 45New Connection .............................................................................................................................. 46Edit Table Data ............................................................................................................................... 46Edit SQL Script ................................................................................................................................ 46Manage Connections ....................................................................................................................... 46Manage DB Connections Dialog ....................................................................................................... 46

The Password Storage Vault .................................................................................................... 47Standard TCP/IP Connection .................................................................................................... 48Local Socket/Pipe Connection .................................................................................................. 49Standard TCP/IP over SSH Connection .................................................................................... 50

SQL Editor ...................................................................................................................................... 50Main Menu .............................................................................................................................. 51Toolbar .................................................................................................................................... 52SQL Query Panel .................................................................................................................... 53Main Tabsheets ....................................................................................................................... 54Sidebar .................................................................................................................................... 59

MySQL Workbench provides extensive facilities for working directly with SQL code. Before working directlywith a live server, a connection must be created. After a connection is established, it is possible to executeSQL code directly on the server and manipulate the server using SQL code.

The starting point for embarking on SQL Development work is the SQL Development area of the Homewindow, which has the following action items:

• Open Connection to start Querying

• New Connection

• Edit Table Data

• Edit SQL Script

• Manage Connections

The following sections describe each of these action items.

Note

The SQL Development facility in MySQL Workbench provides the functionality thatwas formerly available in MySQL Query Browser.

Open Connection to Start Querying

Clicking this action item launches the Connect to Database Wizard. From this wizard, you can select apredefined connection. A new SQL Editor tab is launched.

If you already have created a connection to a database, it will appear in this panel as an icon. Double-clicking the icon directly launches an SQL Editor tab, and connects you to the database as defined by theconnection.

Page 54: MySQL Workbench

New Connection

46

To read more about the SQL Editor, see SQL Editor.

New Connection

Clicking the New Connection action item launches the Manage DB Connections wizard. This wizardenables you to create a new connection. Note that the wizard when launched from here does not displayexisting connections, it only enables you to create a new connection.

To read more about creating and managing connections, see Manage DB Connections Dialog.

Edit Table Data

Clicking this action item launches the Edit Table Data wizard, which enables you to edit table data. This isa two-stage wizard. The first stage enables you to select a Stored Connection. The second stage enablesyou to select the Schema and Table you want to edit. After the wizard is completed, an SQL Editor tab islaunched, which displays a data grid that enables you to interactively edit table data as required.

To read more about the SQL Editor, see SQL Editor.

Edit SQL Script

Clicking this action item launches the Edit SQL Script wizard. This is a two-stage wizard. The first stageenables you to select a Stored Connection. The second stage enables you to select an SQL Script file, andoptionally have the script executed after it is opened. After the wizard is completed, an SQL Editor tab willbe launched, with the script displayed. If you selected to run the script, MySQL Workbench runs the scriptand displays the results.

Working with large data sets

The Edit SQL Script wizard is not well-suited for executing large dump files, andinstead the Server Administration, Manage Import/Export feature should be used.

Manage Connections

Clicking this action item launches the Manage DB Connections wizard. This wizard also displays StoredConnections, which can be selected and changed as desired. This wizard can also be used to create newconnections.

To read more about managing connections, see Manage DB Connections Dialog.

Manage DB Connections Dialog

MySQL Workbench provides a Manage DB Connections dialog for creating and managing connectionsto servers. The connections created can then be used from the wizards that must connect to a server,such as the wizard used to reverse engineer a live database. However, it is still possible to set connectionparameters from these wizards if required, without invoking the Manage DB Connections dialog directly.

The Manage DB Connections dialog is invoked by selecting Database, Manage Connections from the mainmenu. It can also be invoked from any of the wizards requiring access to a live database. This is achievedby using the Manage Stored Connections item, found in the wizard's Stored Connection list.

After the Manage DB Connections dialog is launched, you are presented with the following dialog, whichenables you to create or delete connections.

Page 55: MySQL Workbench

The Password Storage Vault

47

Figure 6.1. Manage DB Connections - Dialog

Click New to create a new connection. Once created, the connection can be selected from the StoredConnections list. You can then set various parameters for the connection, including the following:

• Connection Name: The name used to refer to this connection. This connection can then be selectedfrom a list in other wizards requiring a connection.

• Connection Method: The methods available are Standard TCP/IP, Local Socket/Pipe, and StandardTCP/IP over SSH.

After you select a connection method, the fields available in the Parameters tab and the Advanced tabof the dialog changes accordingly. More details about these options and parameters are available in thefollowing sections.

After all parameters have been set as required, you can click the Test Connection button to test theconnection to the live server. After you are satisfied that the connection works as expected, you can closethe wizard by clicking the Close button. The stored connection then is available for use from any of thewizards requiring a connection to a live server.

You can duplicate an existing connection using the Duplicate button. This is an easy way to begin settingup a new connection that differs only slightly from an existing one.

The Password Storage Vault

The vault provides a convenient secure storage for passwords used to access MySQL servers. By usingthe vault, you need not enter credentials every time MySQL Workbench attempts to connect to a server.The vault is implemented differently on each platform:

• Windows: The vault is an encrypted file in the MySQL Workbench data directory. This is whereconnections.xml and related files are located. The file is encrypted using a Windows API whichperforms the encryption based on the current user, so only the current user can decrypt it. As a result itis not possible to decrypt the file on any other computer. It is possible to delete the file, in which case all

Page 56: MySQL Workbench

Standard TCP/IP Connection

48

stored passwords are lost, but MySQL Workbench will otherwise perform as expected. You then mustre-enter passwords as required.

• Mac OS X: The vault is implemented using the Mac OS X Secure Keychain. The keychain contents canbe viewed using the Keychain Access.app utility.

• Linux: The vault works by storing passwords using the gnome-keyring daemon, which must berunning for password persistency to work. The daemon is automatically started in GNOME desktops, butnormally is not in KDE and others. The gnome-keyring daemon can be used for password storage inMySQL Workbench on non-GNOME platforms, but must be started manually.

Standard TCP/IP Connection

This connection method enables MySQL Workbench to connect to MySQL Server using TCP/IP.

Parameters tab

• Hostname: The host name or IP address of the MySQL server.

• Username: User name to use for the connection.

• Password: Optional password for the account used. If you enter no password here, you will beprompted to enter the password when MySQL Workbench attempts to establish the connection. MySQLWorkbench can store the password in a vault (see The Password Storage Vault).

• Port: The TCP/IP port on which the MySQL server is listening (the default is 3306).

• Default Schema: When the connection to the server is established, this is the schema that will be usedby default. It becomes the default schema for use in other parts of MySQL Workbench.

Advanced tab

More parameters can be set for the connection by using the Advanced tab.

Figure 6.2. Manage DB Connections - Advanced Tab

Page 57: MySQL Workbench

Local Socket/Pipe Connection

49

The Advanced tab includes these check boxes:

• Use compression protocol: If checked, the communication between the application and the MySQLserver will be compressed, which may increase transfer rates. This corresponds to starting a MySQLcommand-line client with the --compress option.

• Use SSL if available: This option turns on SSL encryption. The client library must support this option.Note: This feature is currently not supported.

• Use ANSI quotes to quote identifiers: Treat “"” as an identifier quote character (like the “`” quotecharacter) and not as a string quote character. You can still use “`” to quote identifiers with this modeenabled. With this option enabled, you cannot use double quotation marks to quote literal strings,because it is interpreted as an identifier. Note: If this option is selected, it overrides the server setting.

Local Socket/Pipe Connection

This connection method enables MySQL Workbench to connect to MySQL Server using a socket file (onUnix) or a named pipe (on Windows).

Parameters

The unique field here is Socket/Pipe Path. Enter the name of the socket or pipe here. If the field is leftblank, the default socket or pipe name is used. On Unix, the default socket name is /tmp/mysql.sock.On Microsft Windows, the default pipe name is MySQL.

This option can be seen in the following screenshot.

Figure 6.3. Manage DB Connections - Socket/Pipe Parameters

Advanced

The only option available in this tab is Use ANSI quotes to quote identifiers. This option was discussedin Standard TCP/IP Connection.

Page 58: MySQL Workbench

Standard TCP/IP over SSH Connection

50

Standard TCP/IP over SSH Connection

This connection method enables MySQL Workbench to connect to MySQL Server using TCP/IP over anSSH connection.

Parameters

In addition to a number of parameters that are in common with Standard TCP/IP connections, thisconnection method features a number of specialized parameters. These are listed here:

• SSH Hostname: This is the name of the SSH server. An optional port number can also be provided.

• SSH Username: This is the name of the SSH user name to connect with.

• SSH Password: The SSH password. It is recommended that an SSH key file is also used.

• SSH Key File: A path to the SSH key file. Note: Only key files in OpenSSH format are currentlysupported.

These options can be seen in the following screenshot.

Figure 6.4. Manage DB Connections - SSH Parameters

Advanced

The options here are the same as for the Standard TCP/IP connection. See Standard TCP/IP Connection.

SQL Editor

MySQL Workbench 5.2 introduced the SQL Editor facility. The SQL Editor can be launched using variousaction items on the Home window. It can also be launched by selecting Database, Query Database fromthe main menu, or by using the keyboard shortcut Control+U on Windows, or Command+U on Mac

Page 59: MySQL Workbench

Main Menu

51

OS X. At this point, you will be asked to either select a stored connection or enter the details for a newconnection. After a connection has been made to the server, a new tab called SQL Editor (schema) isdisplayed.

Figure 6.5. SQL Editor

The SQL Editor user interface has these main elements:

• Main Menu

• Toolbar

• SQL Query Panel

• Main Tabsheets (Overview, Output, History, Snippets, Results)

• Sidebar

The following sections describe each of these elements.

Main Menu

When an SQL Editor tab is selected, the most important items on the main menu bar are the Query andEdit menus.

Query Menu

Page 60: MySQL Workbench

Toolbar

52

The Query menu features the following items:

• Execute (All or Selection): Executes all statements in the SQL Query area, or only the selectedstatements.

• Execute Current Statement: Executes the current SQL statement.

• Explain (All or Selection): Describes all statements, or the selected statement.

• Explain Current Statement: Describes the current statement.

• Stop: Stops executing the currently running script.

• Reconnect to Server: Reconnects to the MySQL server.

• New Tab: Creates a duplicate of the current SQL Editor tab.

• Commit Transaction: Commits a database transaction.

• Rollback Transaction: Rolls back a database transaction.

• Refresh: Synchronizes with the live server and refreshes views such as the live Overview tabsheet.

• Commit Result Edits: Commits any changes you have made to the server.

• Discard Result Edits: Discards any changes you have made.

• Export Results: Exports result sets to a file. Selecting this option displays the Export Query Results toFile dialog. The dialog enables you to select which result set you wish to export, the file format (CSV,HTML, XML), and the name and location of the output file. Then click Export to export the data.

Edit Menu

The Edit menu features the Format submenu. The Format submenu includes the following menu items thatare of importance when in SQL Editor mode:

• Beautify Query: Reformats the query selected in the query tab and lays it out in nicely indented fashion.

• UPCASE Keywords: Converts keywords to uppercase in the currently selected query in the query tab.

• lowercase Keywords: Converts keywords to lowercase in the currently selected query in the query tab.

• Indent Lines: Indents the lines selected in the query tab.

• Unindent Lines: Unindents the lines selected in the query tab.

• Un/Comment Selection: Comments the lines currently selected in the query tab. If the lines are alreadycommented, this operation removes the comments.

Toolbar

The toolbar features buttons in two locations, in the main toolbar and within the SQL Editor itself. The SQLEditor buttons are described below.

Figure 6.6. SQL Editor - Toolbar

Page 61: MySQL Workbench

SQL Query Panel

53

From left to right, these buttons are:

• Open a SQL Script File: Loads a saved SQL script to be ready for execution. The script is displayed inthe SQL Query area.

• Save SQL Script to File: Saves the currently loaded SQL script to a file specified by the user.

• Execute SQL Script: Executes the selected portion of the query, or the entire query if nothing isselected.

• Execute Current SQL script: Execute the statement under the keyboard cursor.

• Explain (All or Selection): Execute the EXPLAIN command on the query under the keyboard cursor.

• Stop the query being executed: Halts execution of the currently executing SQL script. Note: thedatabase connection will not be restarted, and open transactions will remain open.

• Toggle whether execution of SQL script should continue after failed statements: If the red“breakpoint” circle is displayed, the script terminates on a statement that fails. If the button is depressedso that the green arrow is displayed, execution continues past the failed code, possibly generatingadditional result sets. In either case, any error generated from attempting to execute the faulty statementis recorded in the Output tabsheet.

• Commit: Commits the current transaction. Note: All query tabs in the same connection share the sametransactions. To have independent transactions, a new connection must be opened.

• Rollback: Rolls back the current transaction. Note: All query tabs in the same connection share thesame transactions. To have independent transactions, a new connection must be opened.

• Toggle Auto-Commit Mode: If selected, each statement will be committed independently. Note: Allquery tabs in the same connection share the same transactions. To have independent transactions, anew connection must be opened.

• Beautify SQL: Beautify/reformat the SQL script.

• Find panel: Show the Find panel for the editor.

• Invisible characters: Toggle display of invisible characters, such as newlines, tabs, spaces.

SQL Query Panel

In this area, you can enter SQL statements directly. The statements entered can be saved to a file orsnippet for later use. At any point, you can also execute the statements you have entered.

To save a snippet of code entered into the SQL Query panel, click the Save SQL to Snippets Listicon in the Snippets panel, enter a name (optional), and click OK. The snippet can be inserted into the SQLQuery panel at any time by double-clicking the snippet in the SQL Snippets panel.

Page 62: MySQL Workbench

Main Tabsheets

54

Figure 6.7. SQL Editor - SQL Query Panel

Executing a SELECT query will display the associated result set in the SQL View panel, directly below theSQL Query panel. These cells are editable if MySQL Workbench is able to determine how, as for examplethey are editable if a Primary or Unique key exists within the result set. If not, MySQL Workbench willdisplay a "read-only" icon at the bottom-right corner of the SQL View panel, and hovering the mouse cursorover this icon will provide a hint as to why it's not editable.

Note

To quickly enter the name of a table, view, or column, double-click the item in theSchemata Palette. The item name will be inserted into the SQL Query panel.

Main Tabsheets

The main tabsheets area contains several tabs:

• Output and History Tabsheet

Page 63: MySQL Workbench

Main Tabsheets

55

• Results Tabsheets

• Live Editing Tabsheet

Figure 6.8. SQL Editor - Main Tabsheets

The following sections describe each of these in more detail.

Output and History Tabsheet

The Output and History tabsheet is located at the bottom of MySQL Workbench, and can be toggled on oroff. It contains a select box that includes Action Output, Text Output, and History options.

The Action Output tabsheet displays a summary of the communication between the script and the server.The messages displayed can be information or errors. Each message displays the time, the action thatwas carried out, and the response from the server. This output is useful for troubleshooting scripts.

The Text Output tabsheet will display a textual representation of the query, as displayed using the MySQLConsole. Use Query, Execute (All or Selection) to Text to send output to this tabsheet.

The History tabsheet provides a history of SQL operations carried out. The time and SQL code for eachoperation is recorded. To view the SQL executed, click the time, and the SQL code executed will bedisplayed in the SQL column.

Results Tabsheets

The results area of the screen shows the results from any queries that have been executed. If the scriptcontains multiple queries, a result tab will be generated for each query that returns results.

Page 64: MySQL Workbench

Main Tabsheets

56

Figure 6.9. SQL Editor - Results Tabsheets

Controls are provided to enable you to easily move over the results. These are shown in the followingscreenshot.

Figure 6.10. SQL Editor - Results Tabsheets Navigation Controls

From left to right, the controls are:

• Move to first row: Highlights the first row in the current result set.

• Move to previous row: Highlights the previous row.

• Move to next row: Highlights the next row.

• Move to last row: Highlights the last row in the current result set.

• Toggle wrapping of cell contents: Toggles between truncating or wrapping the data in a cell.

• Sort Ascending: Sorts the selected column in ascending order.

Page 65: MySQL Workbench

Main Tabsheets

57

• Sort Descending: Sorts the selected column in descending order.

• Export record set to an external file: Writes a result set to a CSV, HTML, or XML file as required.

• Refresh Data from Data Source: Refreshes the current result set from the data source.

• Search for substring within data: Searches the data for the string entered in the search box.

Live Editing Tabsheets

It is possible to edit data in real time using the Live Editing tabsheets. The live editor is the default viewtype, so it will be displayed after running a SELECT query or by right-clicking a table in the Schema Viewerand choosing Edit Data Table.

The top part of the result set may be resized to reveal the SELECT query that it originated from. This querycan be altered to show only columns you want, which might mean adding a WHERE clause.

In addition to the controls offered by the Results tabsheet, the Live Editor tab features some additionalcontrols. These controls are highlighted in the following screenshot.

Page 66: MySQL Workbench

Main Tabsheets

58

Figure 6.11. SQL Editor - Live Editing Tabsheet Navigation Controls

Page 67: MySQL Workbench

Sidebar

59

These additional controls enable you to make changes other than simple edits, like inserting/removingrows and exporting the data.

From left to right, the additional controls are:

• Edit current row: Enters edit mode for the currently selected row. Double-clicking a cell has the sameeffect.

Note

It is possible to enter a function, or other expression, into a field. Use the prefix\func to prevent MySQL Workbench from escaping quotation marks. Forexample, for the expression md5('fred'), MySQL Workbench normally wouldgenerate the code md5(\'fred\'). To prevent this, enter the expression as\func md5('fred') to ensure that the quoting is not escaped.

• Insert new row: Inserts a new row and enables you to enter data. Your changes will not be reflected onthe live server until you click Apply changes to data.

• Delete selected rows: Removes the selected rows. Your changes will not be reflected on the live serveruntil you click Apply changes to data.

• Export: Exports the result set as a file to a defined location. The same as choosing Query, ExportResults... from the main menu. Data may be exported as several formats, including CSV, HTML, JSON,SQL, and XML.

See also The Inserts Tab.

Sidebar

The Sidebar contains these panels:

• Session (connection) Information

• Snippets

• Schemas

The following sections describe each panel in more detail.

Snippets panel

The Snippets sidebar offers both built-in and custom snippets. The sidebar contains a select box, with MySnippets for custom snippets, and built-in options titled DB Mgmt (Database Management), SQL DDL(SQL Data Definition Language), and SQL DML (SQL Data Manipulation Language).

Snippets may be given names, and these snippets can be viewed and edited from the Snippets sidebar. Toload a snippet into the SQL Query area, either choose the Snippets Insert icon or right-click on the desiredsnippet and choose Insert. Double-click a snippet to open an edit context, to edit the snippet body or title.This example shows two snippets, with only the first having defined a name.

Page 68: MySQL Workbench

Sidebar

60

Figure 6.12. SQL Editor - Snippets Palette

Session and Object Information Panel

This panel summarizes the current connection to the server.

Page 69: MySQL Workbench

Sidebar

61

Figure 6.13. SQL Editor - Connection Information Palette

This panel also summarizes information about the object.

Figure 6.14. SQL Editor - Object Info

Object Browser

The Object Browser contains an Actions list and a Schemata list, as seen in the following screenshot.

Page 70: MySQL Workbench

Sidebar

62

Figure 6.15. SQL Editor - Object Browser

Object Browser Actions List

The Object Browser contains an Actions list. The actions are:

• Execute SQL File: Opens a file chooser dialog that enables you to select an SQL script to execute.

• Add Schema: Enables you to add a new schema to your server.

• Add Table: Enables you to create a new table via the new_table dialog.

• Add View: Enables you to create a new view via the new_view dialog.

• Add Routine: Enables you to create a new routine via the new_routine dialog.

Schemata List

The Schemata list shows available schemata on the currently connected server. These can be explored toshow tables, views, and routines within the schema.

Page 71: MySQL Workbench

Sidebar

63

Figure 6.16. SQL Editor - Schemata Explorer

It is possible to set a schema as the default schema by right-clicking the schema and selecting the SetAs Default Schema menu item. This executes a USE schema_name statement so that subsequentstatements without schema qualifiers are executed against this schema. This setting applies only tothe query session. To set a default schema for multiple MySQL Workbench sessions, you must set thedefault schema for the stored connection. From the Home screen, click Manage Connections, then in theManage DB Connection dialog, set the desired default schema on the Parameters tab.

A useful feature that was introduced in MySQL Workbench 5.2.9 is the ability to rapidly enter table, view,or column names into the SQL Statement area. Double-clicking a table, view, or column name in theschemata explorer inserts the name into the SQL Query area. This reduces typing significantly whenentering SQL statements containing references to several tables, views, or columns.

The Object Browser also features a context menu which can be displayed by right-clicking an object. Forexample, right-clicking a table displays the following menu items:

Page 72: MySQL Workbench

Sidebar

64

• Select Rows - Limit 1000: Pulls up to 1000 rows of table data from the live server into a Resultstabsheet.

• Edit Table Data: Pulls table data from the live server into a named tabsheet, and enables editing. Datacan be saved directly to the live server.

• Copy to Clipboard: There are various submenus, each of which copies information to the clipboard:

• Name (short): Copies the table name.

• Name (long): Copies the qualified table name in the form `schema`.`table`.

• Column Names: Copies qualified column names the form `table`.`column1`,`table`.`column2`,....

• Select All Statement: Copies a statement to select all columns in this form:

SELECT`table`.`column1`,`table`.`column2`,...FROM `schema`.`table`;

• Insert Statement: Copies an INSERT statement to insert all columns.

• Update Statement: Copies an UPDATE statement to update all columns.

• Delete Statement: Copies a DELETE statement in the form DELETE FROM `world`.`country`WHERE <where_condition>;.

• Send to SQL Editor: Provides functionality similar to Copy to Clipboard. However, this item inserts theSQL code directly into the SQL Query panel, where it can be edited further as required.

• Alter Table: Displays the table editor loaded with the details of the table.

• Create Table: Launches a dialog to enable you to create a new table.

• Drop Table: Drops the table. All data in the table will be lost if this operation is carried out.

• Refresh All: Refreshes all schemata in the explorer by resynchronizing with the server.

Right-clicking an empty area inside the object browser displays the following menu items:

• Create Schema: Enables you to create a new schema on the connected server. You can apply yourchanges to synchronize with the live server by clicking the Apply button.

• Refresh All: Synchronizes with the live server to update the information displayed by the schemataexplorer.

Page 73: MySQL Workbench

65

Chapter 7. Data Modeling

Table of ContentsOpen an Existing EER Model ........................................................................................................... 66Create New EER Model ................................................................................................................... 66Create EER Model from Existing Database ....................................................................................... 66Create EER Model from SQL Script ................................................................................................. 66Model Editor .................................................................................................................................... 67

Modeling Menus ...................................................................................................................... 68The Toolbar ............................................................................................................................. 77EER Diagrams ......................................................................................................................... 78The Physical Schemata Panel .................................................................................................. 78The Schema Privileges Panel ................................................................................................... 79The SQL Scripts Panel ............................................................................................................ 80The Model Notes Panel ........................................................................................................... 80The History Palette .................................................................................................................. 81The Model Navigator Panel ...................................................................................................... 81The Catalog Tree Palette ......................................................................................................... 81The Layers Palette .................................................................................................................. 82The Properties Palette ............................................................................................................. 82

EER Diagram Editor ........................................................................................................................ 83The Vertical Toolbar ................................................................................................................ 83

Working with Models ........................................................................................................................ 87Creating Tables ....................................................................................................................... 87Creating Foreign Key Relationships ........................................................................................ 101Creating Views ....................................................................................................................... 105Creating Routines and Routine Groups ................................................................................... 107Creating Layers ..................................................................................................................... 110Creating Notes ....................................................................................................................... 112Creating Text Objects ............................................................................................................ 112Creating Images .................................................................................................................... 113Reverse Engineering .............................................................................................................. 114Forward Engineering .............................................................................................................. 123

Modeling Tutorials .......................................................................................................................... 143Importing a Data Definition SQL Script .................................................................................... 144Using the Default Schema ...................................................................................................... 145Basic Modeling ...................................................................................................................... 147Documenting the sakila Database ....................................................................................... 149

Printing .......................................................................................................................................... 151Printing Options ..................................................................................................................... 151

MySQL Workbench Schema Validation Plugins (Commercial Version) .............................................. 151General Validation .................................................................................................................. 151MySQL-Specific Validation ...................................................................................................... 152

The DBDoc Model Reporting Dialog Window (Commercial Version) .................................................. 153Customizing DBDoc Model Reporting Templates ............................................................................. 157

Supported Template Markers .................................................................................................. 161Creating a Custom Template .................................................................................................. 164

MySQL Workbench provides extensive capabilities for creating and manipulating database models,including these:

Page 74: MySQL Workbench

Open an Existing EER Model

66

• Create and manipulate a model graphically

• Reverse engineer a live database to a model

• Forward engineer a model to a script or live database

• Create and edit tables and insert data

This is not an exhaustive list. The following sections discuss these and additional data-modelingcapablities.

The Home window is the typical starting point for work with data modeling. In the Data Modeling sectionof the Workspace, you can use the action items there to create and manage models, forward and reverseengineer, and compare and synchronize schemata:

• Open an Existing EER Model

• Create new EER Model

• Create EER Model from Existing Database

• Create EER Model from SQL Script

The following sections describe these action items.

Open an Existing EER ModelClicking this action item launches a file browser. You can then select the model file you wish to load. A newMySQL Model tab will then be created, and your model displayed.

If you have already created one or more model files, each will appear in this panel as an icon. Double-clicking the item of the model you wish to load creates a new MySQL Model tab and displays your model.

If you already have created a connection to a database, it will appear in this panel as an icon. Double-clicking the icon directly launches an SQL Editor tab, and connects you to the database as defined by theconnection.

To read more about modeling, see Model Editor.

Create New EER ModelClicking this action item launches a new MySQL Model tab, with a blank model ready for you to work on.

To read more about modeling, see Model Editor.

Create EER Model from Existing DatabaseThis action item enables you to create an EER Model from an existing live database. Clicking this actionitem launches the Reverse Engineer Database. This is a multi-stage wizard that enables you to select aconnection to a live server, and select the schema and objects you wish to reverse engineer into your newmodel. This is a convenient way to see how an existing database is structured.

For further information about reverse engineering, see Reverse Engineering a Live Database.

Create EER Model from SQL ScriptThis action item enables you to create a model from an SQL Create script. Such a script may have beencreated by hand or as a result of reverse engineering an existing database. The script may then be

Page 75: MySQL Workbench

Model Editor

67

modified according to requirements. Clicking this action item launches the Reverse Engineer SQL Scriptwizard. This is a multi-stage wizard that enables you to select the script you want to create your modelfrom.

For further information, see Reverse Engineering Using a Create Script.

Model Editor

When the Model Editor is executed from the Home window, MySQL Workbench displays the MySQLModel page. The MySQL Model page has three main panels, as shown in the following screenshot:Description Editor, User Types List/History panel, and Model Overview.

Figure 7.1. The MySQL Model Page

Page 76: MySQL Workbench

Modeling Menus

68

The Description Editor and User Types List/History panel are contained within the Sidebar. The Sidebaris located on the left by default, but can be relocated to the right using a setting in the WorkbenchPreferences dialog.

The Model Overview panel has several sections:

• EER Diagrams

• Physical Schemata

• Schema Privileges

• SQL Scripts

• Model Notes

For each of these sections, add objects to a project by clicking the appropriate add-object icon. You mayalso rename, edit, cut, copy, or delete objects on this page by right-clicking to open a pop-up menu.

The following sections further discuss the MySQL Model page.

Modeling Menus

Some menu items are not available in the OSS version of this application, and are available only in theStandard Edition. This is indicated where applicable.

The File Menu

Use the File menu to open a project, begin a new project, or save a project. Choosing New Model opensthe default schema, mydb. Choosing Open Model opens a file dialog box with the default file type set toMySQL Workbench Models (mwb extension). To display a list of recently opened MWB files, choose theOpen Recent menu item. The keyboard shortcut to create a new project is Control+N and the command toopen an existing project is Control+O.

To close the currently active MySQL Model or EER Diagram tab, use the Close Tab menu item. Youcan also do this from the keyboard by pressing Control+W. To reopen the MySQL Model tab, see TheView Menu. To reopen an EER Diagram tab, double-click the EER Diagram icon in the EER Diagramssection of the MySQL Model page.

Use the Save Model or Save Model As menu items to save a model. When you save a model, its nameappears in the title bar of the application. If you have made changes to a project and have not saved thosechanges, an asterisk appears in the title bar following the model name. When you save a model, it is savedas a MySQL Workbench file with the extension mwb.

Use the Import menu item to import a MySQL data definition (DDL) script file. For example, this might be afile created by issuing the command mysqldump --no-data. MySQL Workbench handles the script asfollows:

• If the script does not contain a CREATE DATABASE db_name; statement, the schema objects arecopied to the default schema, mydb.

• If the script creates a database, a new tab bearing the database name is added to the PhysicalSchemata section of the MySQL Model page.

• If the script contains data, the data is ignored.

Page 77: MySQL Workbench

Modeling Menus

69

For details about importing a DDL script, see Reverse Engineering Using a Create Script.

Under the Import submenu, you can also import DBDesigner4 files.

There are variety of items under the Export submenu. You may generate the SQL statements necessaryto create a new database or alter an existing one. For more information about these menu items, seeForward Engineering Using an SQL Script.

Using the Export submenu, you can also export an EER diagram as a PNG, SVG, PDF, or Postscript file.For an example of a PNG file, see Figure 7.49, “The sakila Database EER Diagram”.

The Page Setup menu item enables you to set the paper size, orientation, and margins for printingpurposes.

The printing options are enabled only if the EER Diagrams tab is selected. You have the choice ofprinting your model directly to your printer, printing it as a PDF file, or creating a PostScript file. For moreinformation, see Printing.

Note

The printing options are available only in commercial versions of MySQLWorkbench.

Use the Document Properties menu item to set the following properties of your project:

• Name: The model name (default is MySQL Model)

• Version: The project version number

• Author: The project author

• Project: The project name

• Created: Not editable; determined by the MWB file attributes

• Last Changed: Not editable; determined by the MWB file attributes

• Description: A description of your project

The Edit Menu

Use the Edit menu to make changes to objects. The text description for several of the menu items changesto reflect the name of the currently selected object.

This menu has items for cutting, copying, and pasting. These actions can also be performed usingthe Control+X, Control+C, and Control+V key combinations. Undo a deletion using the Undo Delete'object_name' item. The Control+Z key combination can also be used to undo an operation. It is alsopossible to carry out a Redo operation using either the menu item, or the key combination Control+Y.

Also find a Delete 'object_name' menu item for removing the currently selected object. The keyboardcommand for this action is Control+Delete. You can also right-click an object and choose the delete optionfrom the pop-up menu.

The Delete 'object_name' menu item behaves differently depending upon circumstances. For example,if an EER Diagram is active and a table on the canvas is the currently selected object, a dialog box mayopen asking whether you want to remove the table from the canvas only or from the database as well. Forinformation about setting the default behavior when deleting from an EER Diagram, see The Model Tab.

Page 78: MySQL Workbench

Modeling Menus

70

Warning

If the MySQL Model page is active, the selected object is deleted from the catalogand there will be no confirmation dialog box.

Choose Edit Selected to edit the currently selected object. You can also perform edits in a new window byselecting Edit Selected in New Window. The keyboard shortcuts for Edit Selected and Edit Selected in NewWindow are Control+E and Control+Shift+E, respectively.

The Select item has the following submenus:

• Select All (Keyboard shortcut, Control+A): Selects all the objects on the active EER diagram.

• Similar Figures (Objects of the same type): Finds objects similar to the currently selected object.

• Connected Figures: Finds all the objects connected to the currently selected object.

These menu items are active only when an EER Diagram tab is selected. The Similar Figures and theConnected Figures menu items are disabled if no object is currently selected on an EER diagram.

When multiple objects have been selected using one of these menu items, you can navigate betweenselected items by choosing the Go to Next Selected or Go to previous Selected menu item.

Selecting objects changes some of the Edit menu items. If only one object is selected, that object's nameappears after the Cut, Copy and Delete menu items. If more than one object is selected, these menu itemsshow the number of objects selected.

Find Dialog Window

The Find submenu displays the following menu items:

• Find: Takes you to the toolbar search box. You can look for objects in the current view. Find can locateobjects in the Model view, the EER Diagram view, and also in the Catalog palette.

• Find Next: Finds the next occurrence of the object.

• Find Previous: Finds the previous occurrence of the object.

• Search and Replace: Displays the Search and Replace dialog. This is currently for use only with the SQLEditor, to enable you to quickly search and replace script code items.

The Standard Edition of MySQL Workbench includes a more advanced Find facility:

Page 79: MySQL Workbench

Modeling Menus

71

Figure 7.2. The Find Window

You can search the following locations:

• Entire Model: Searches the entire model.

• Current View: Searches the current view only. This may be the MySQL Model page.

• All Views: Searches the MySQL Model Page and all EER diagrams.

• Database Objects: Searches database objects only.

• Selected Figures: Searches the currently selected objects. This feature works only for EER diagrams.

Enter the text you wish to search for in the Find Text list. You may also select any or all of the followingcheck boxes:

• Match Case

• Whole Word

• Use Regular Expression

• Search in Comments

• Search in SQL for Views, SPs etc.

Any text you enter into the Find Text list is retained for the duration of your session. Use the Next orPrevious buttons to find occurrences of your search criterion.

Page 80: MySQL Workbench

Modeling Menus

72

Clicking the Find All button opens a Find Results window anchored at the bottom of the application. If youwish, you may undock this window as you would any other.

Use this window to navigate to objects. For example, double-clicking the Description of an objectlocated on an EER diagram navigates to the specific diagram and selects the object. Notice that theproperties of the object are displayed in the Properties palette.

The Find dialog window can also be opened using the Control+F key combination. Use Control+G to findthe next occurrence and Control+Shift+G to find a previous occurrence. Close the Find dialog window byclicking the x in the top right corner or by pressing the Esc key.

Workbench Preferences

This menu item enables you to set global preferences for the MySQL Workbench application.

For further information, see Workbench Preferences.

The View Menu

The View menu has these items:

• Home: Selects the Home window

• Windows: A submenu with items that provide a means for opening the windows associated with them:

• Model Navigator: Opens the Model Navigator palette

• Catalog: Opens the Catalog palette

• Layers: Opens the Layers palette

• User Datatypes: Opens the User Datatypes palette

• Object Descriptions: Opens the Description palette

• Object Properties: Opens the Properties palette

• Undo History: Opens the History palette

• Output: Displays the console output. The keyboard shortcut for this menu item is Control+F2.

• Reset Window Layout: Resets all windows to their default layout

• Zoom 100%: The default level of detail of an EER diagram

• Zoom In: Zooms in on an EER diagram.

• Zoom Out: Zooms out from an EER diagram.

The ability to zoom in on an EER diagram is also available using the slider tool in the ModelNavigator palette. See The Model Navigator Panel.

• Set Marker: Bookmarks an object. From the keyboard, select the object you wish to bookmark, then usethe key combination Control+Shift and the number of the marker (1 through 9). You may create up tonine markers.

• Go To Marker: Returns to a marker. From the keyboard, use the Control key and the number of themarker.

Page 81: MySQL Workbench

Modeling Menus

73

• Toggle Grid: Displays grid lines on an EER diagram.

• Toggle Page Guides: Toggles Page Guides.

The Arrange Menu

The Arrange menu items apply only to objects on an EER diagram canvas and are enabled only if an EERdiagram view is active. The Arrange menu has these items:

• Align to Grid: Aligns items on the canvas to the grid lines

• Bring to Front: Brings objects to the foreground

• Send to Back: Sends objects to the background

• Center Diagram Contents: Centers objects on the canvas

• Autolayout: Automatically arranges objects on the canvas

• Reset Object Size: Expands an object on an EER diagram. For example, if a table has a long columnname that is not fully displayed, this menu item expands the table to make the column visible. This menuitem is not enabled unless an object is selected.

• Expand All: Use this item to expand all objects on an EER diagram. This item will display a table'scolumns if the object notation supports expansion. Some object notations, such as Classic, do notpermit expansion or contraction. Indexes will not automatically be expanded unless they were previouslyexpanded and have been collapsed using the Collapse All menu item.

• Collapse All: Undo the operation performed by Expand All.

The Model Menu

The Model menu has these items:

• Add Diagram: Creates a new EER Diagram. The keyboard shortcut is Control+T.

• Create Diagram From Catalog Objects: Creates an EER diagram from all the objects in the catalog.

• DBDoc – Model Reporting...: For information about this menu item, see The DBDoc Model ReportingDialog Window (Commercial Version). Commercial version only.

• User Defined Types: Presents a dialog box that enables you to add and delete user defined data types.

• Object Notation: For information about this menu item, see The Object Notation Submenu.

• Relationship Notation: For information about this menu item, see The Relationship Notation Submenu.

• Diagram Properties and Size: Opens a diagram size dialog box that enables you to adjust the width orheight of the canvas. The unit of measure is pages; the default value is two.

When you have tables with numerous columns, use this menu item to increase the size of the EER.

• Validation: For information about this menu item, see The Validation Submenus (Commercial Version).Commercial version only.

• Model Options: Sets options at the model level. These options should not be confused with theoptions that are set globally for the Workbench application, and which are referred to as WorkbenchPreferences. The available model options are a subset of the Workbench Preferences options.

For more information about Workbench Preferences, see The Model Tab.

Page 82: MySQL Workbench

Modeling Menus

74

The DBDoc Model Reporting Dialog Window (Commercial Version)

This dialog window is found by navigating to the Model menu and choosing the DBDoc - Model Reporting...item.

Note

The DBDoc - Model Reporting... item is not available in the MySQL WorkbenchOSS version.

Use this dialog window to set the options for creating documentation of your database models. For moreinformation, see The DBDoc Model Reporting Dialog Window (Commercial Version).

The Validation Submenus (Commercial Version)

The Model menu has two validation submenus, Validation and Validation (MySQL). Use these submenusfor general validation and MySQL-specific validation of the objects and relationships defined in your model.

Note

These items are not available in the MySQL Workbench OSS version.

The Validation submenu has these items:

• Validate All: Performs all available validation checks

• Empty Content Validation: Checks for objects with no content, such as a table with no columns

• Table Efficiency Validation: Checks the efficiency of tables, such as a table with no primary key defined

• Duplicate Identifiers Validation: Checks for duplicate identifiers, such as two tables with the same name

• Consistency Validation: Checks for consistent naming conventions

• Logic Validation: Checks, for example, that a foreign key does not reference a nonprimary key column inthe source table

The Validation (MySQL) submenu has these items:

• Validate All: Performs all available validation checks

• Integrity Validation: Checks for invalid references, such as a table name longer than the maximumpermitted

• Syntax validation: Checks for correct SQL syntax

• Duplicate Identifiers Validation (Additions): Checks for objects with the same name

For detailed information about validation, see MySQL Workbench Schema Validation Plugins (CommercialVersion).

The Object Notation Submenu

The items under the Object Notation submenu apply exclusively to an EER diagram. They are not enabledunless an EER diagram tab is selected.

The Object Notation submenu has these items:

• Workbench (Default): Displays table columns, indexes, and triggers

Page 83: MySQL Workbench

Modeling Menus

75

• Workbench (Simplified): Shows only a table's columns

• Classic: Similar to the Workbench (Simplified) style showing only the table's columns

• IDEF1X: The ICAM DEFinition language information modeling style

The object notation style that you choose persists for the duration of your MySQL Workbench session andis saved along with your model. When MySQL Workbench is restarted, the object notation reverts to thedefault.

Note

If you plan to export or print an EER diagram be sure to decide on a notation stylefirst. Changing notation styles after objects have been placed on a diagram cansignificantly change the appearance of the diagram.

The Relationship Notation Submenu

The items under the Relationship Notation submenu apply exclusively to an EER diagram. They are notenabled unless an EER diagram tab is selected.

The Relationship Notation submenu has these items:

• Crow's Foot (IE): The default modeling style. For an example, see Figure 7.46, “Adding Tables to theCanvas”.

• Classic: Uses a diamond shape to indicate cardinality.

• Connect to Columns

• UML: Universal Modeling Language style.

• IDEF1X: The ICAM DEFinition language information modeling method

To view the different styles, set up a relationship between two or more tables and choose the differentmenu items.

The relationship notation style that you choose persists for the duration of your MySQL Workbench sessionand is saved along with your model. When MySQL Workbench is restarted, the relationship notationreverts to the default, the Crow's Foot style.

Note

If you plan to export or print an EER diagram, be sure to decide on a notation stylefirst. Changing notation styles after objects have been placed on a diagram cansignificantly change the appearance of the diagram.

The Database Menu

The Database menu has these items:

• Query Database: Launches the SQL Editor, which enables you to create SQL code and execute it on alive server. For more information, see SQL Editor.

• Manage Connections: Launches the Manage DB Connections dialog, which enables you to create andmanage multiple connections. For more information, see Manage DB Connections Dialog

• Reverse Engineer: Creates a model from an existing database. For more information, see ReverseEngineering a Live Database.

Page 84: MySQL Workbench

Modeling Menus

76

• Forward Engineer: Creates a database from a model. For more information, see Forward Engineering toa Live Server.

• Synchronize with Any Source: Allows you to compare a target database or script with the open model,external script, or a second database, and apply these changes back to the target.

• Synchronize Model: Synchronizes your database model with an existing database. For more information,see Database Synchronization.

• Generate Catalog Diff Report: Compares your schema model with a live database or a script file.Creating a Catalog Diff Report.

The Plugins Menu

The Plugins menu lists any plugins that you may have installed. For more information about this menu, seePlugins.

The Scripting Menu

The Scripting menu has these items:

• Scripting Shell: Launches the MySQL Workbench Scripting Shell

• New Script: Opens a New Script File dialogue, with options to create a Python Script, Lua Script,Python Plugin, or Python Module.

• Open Script: Opens a Open GRT Script dialogue, which defaults to the Workbench scripts directory.Files are opened into the Workbench Scripting Shell window.

• Run Workbench Script File: Executes the specified script

• Install Plugin/Module File: Loads and installs a plugin or module file

• Plugin Manager: Displays information about the plugins that are are installed, and allows disabling anduninstalling the plugins.

The Community Menu

The Community menu has the following items. Use them to go online and learn more about MySQLWorkbench.

• Workbench Blog

• FAQs About Workbench

• Learn How To Code For Workbench

• Discuss Workbench Topics

• Contribute To Workbench

The Help Menu

The Help menu has the following items. Use them to go online and learn more about MySQL Workbench.

• Help Index: Opens a window showing the MySQL Workbench documentation. Read, search, or print thedocumentation from this window.

Page 85: MySQL Workbench

The Toolbar

77

• MySQL.com Website: Opens your default browser on the MySQL Web site home page.

• Workbench Product Page: Opens your default browser on the MySQL Workbench product page.

• System Info: Displays information about your system, which is useful when reporting a bug. For moreinformation, see System Info.

• Report a Bug: Opens the MySQL bug reporting website using your default browser.

• View Reported Bugs: Opens your default browser to see a list of current bugs.

• Locate log file: Opens up the directory that contains the MySQL Workbench log files.

• Check For Updates: Opens the MySQL Workbench website using your default browser, and checks for anewer version.

• About Workbench: Displays the MySQL Workbench About window.

System Info

Use the System Info menu item to display information about your system. This item is especially useful fordetermining your rendering mode. Sample output follows.

read_mysql_cfg_file C:\Program Files\MySQL\MySQL Server 5.1\my.ini[('tmp_table_size', '9M'), ('myisam_sort_buffer_size', '18M'), ('table_cache', '256'), ('read_rnd_buffer_size', '256K'), ('port', '3306'), ('max_connections', '100'), ('innodb_buffer_pool_size', '18M'), ('myisam_max_sort_file_size', '100G'), ('sql-mode', '"STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"'), ('basedir', '"C:/Program Files/MySQL/MySQL Server 5.1/"'), ('default-character-set', 'latin1'), ('datadir', '"C:/ProgramData/MySQL/MySQL Server 5.1/Data/"'), ('innodb_log_buffer_size', '1M'), ('innodb_log_file_size', '10M'), ('innodb_thread_concurrency', '8'), ('read_buffer_size', '64K'), ('innodb_additional_mem_pool_size', '2M'), ('thread_cache_size', '8'), ('innodb_flush_log_at_trx_commit', '1'), ('query_cache_size', '0'), ('sort_buffer_size', '256K'), ('default-storage-engine', 'INNODB'), ('key_buffer_size', '11M')]MySQL Workbench OSS for Windows version 5.2.8Cairo Version: 1.8.6Rendering Mode: GDI requested (create a diagram to confirm)OpenGL Driver Version: Not DetectedOS: unknownCPU: Intel(R) Core(TM)2 Duo CPU T9300 @ 2.50GHz, 1.0 GB RAMVideo adapter info:Adapter type: VirtualBox Graphics AdapterChip Type: VBOXBIOS String: Version 0xB0C2 or laterVideo Memory: 12288 KB

The Toolbar

The MySQL Workbench toolbar is located immediately below the menu bar. Click the tools in the toolbar toperform the following actions:

Page 86: MySQL Workbench

EER Diagrams

78

• The new document icon: Creates a new document

• The folder icon: Opens a MySQL Workbench file (mwb extension)

• The save icon: Saves the current MySQL Workbench project

• The right and left arrows: The left arrow performs an “Undo” operation. The right arrow performs a“Redo” operation.

Other tools appear on the toolbar depending upon the context.

Tool-Specific Toolbar Items

When an EER diagram canvas is selected, the following icons appear to the right of the arrow icons:

• The toggle grid icon: Turns the grid on and off

• The grid icon: Aligns objects on the canvas with the grid

• The new EER diagram icon: Creates a new EER diagram tab.

The toolbar also changes depending upon which tool from the vertical toolbar is active. For discussion ofthese tools, see The Vertical Toolbar.

If the Table tool is active, schemata lists, engine types, and collations appear on the toolbar. The tableproperties can be modified using the Properties Editor.

When an object is selected, the object's properties, such as color, can be changed in the Properties Editor.

EER Diagrams

Use the Add new Diagram icon in the MySQL Model area to create EER diagrams. When you add anEER diagram, a new tab appears below the toolbar. Use this tab to navigate to the newly created EERdiagram. For further discussion of EER Diagrams, see EER Diagram Editor.

The Physical Schemata Panel

The Physical Schemata panel of the MySQL Model page shows the active schemata and the objectsthat they contain.

Expand and contract the Physical Schemata section by double-clicking the arrow on the left of thePhysical Schemata title bar. When the Physical Schemata section is expanded, it displays allcurrently loaded schemata.

Each schema shows as a tab. To select a specific schema, click its tab. When MySQL Workbench is firstopened, a default schema, mydb, is selected. You can start working with this schema or you can load anew MySQL Workbench Models file (mwb extensiona.)

There are a variety of ways to add schema to the Physical Schemata panel. You can open anMWB file, reverse engineer a MySQL create script, or, if you are using a commercial version of MySQLWorkbench, you can reverse engineer a database by connecting to a MySQL server.

You can also add a new schema by clicking the + button on the top right of the Physical Schematapanel. To remove a schema, click its tab and use the - button found to the immediate left of the + button.To the left of these buttons are three buttons that control how database object icons are displayed:

• The left button displays database objects as large icons.

Page 87: MySQL Workbench

The Schema Privileges Panel

79

• The middle button displays small icons in multiple rows.

• The right button displays small icons in a single list.

The Schema Objects Panel

The Physical Schemata panel has the following sections:

• Tables

• Views

• Routines

• Routine Groups

Each section contains the specified database objects and an icon used for creating additional objects.

Any database objects added to an EER diagram canvas also show up in the Physical Schematasection. For information about adding objects to an EER diagram canvas, see EER Diagram Editor.

The Schema Privileges Panel

The Schema Privileges panel has the following sections, used to create users for your schemata andto define roles —:

• Users

• Roles

The following image displays the Schema Privileges section of the MySQL Model tab.

Figure 7.3. Roles and Privileges

Adding Roles

To add a role, double-click the Add Role icon. This creates a role with the default name role1. Right-clicking a role opens a pop-up menu with the following items:

• Cut 'role_name': Cuts the role

• Copy 'role_name': Copies the role

• Edit Role...: Opens the role editor

Page 88: MySQL Workbench

The SQL Scripts Panel

80

• Edit in New Window...: Opens the role editor in a new editor window

• Delete 'role_name': Removes the role

• Copy SQL to Clipboard: Currently not implemented

To rename a role, click the role name. Then you will be able to edit the text.

All roles that have been defined are listed under Roles on the left side of the role editor. Double-clicking arole object opens the role editor docked at the bottom of the page.

Figure 7.4. Role Editor

Select the role to which you wish to add objects. You may drag and drop objects from the PhysicalSchemata to the Objects section of the role editor. To assign privileges to a role, select it from theRoles section, then select an object in the Objects section. In the Privileges section, check the rightsyou wish to assign to this role. For example, a web_user role might have only SELECT privileges and onlyfor database objects exposed through a web interface. Creating roles can make the process of assigningrights to new users much easier.

Adding Users

To add a user, double-click the Add User icon. This creates a user with the default name user1. Double-clicking this user opens the user editor docked at the bottom of the application.

In the User Editor, set the user's name and password using the Name and Password fields. Assignone role or a number of roles to the user by selecting the desired roles from the field on the right and thenclicking the < button. Roles may be revoked by moving them in the opposite direction.

Right-clicking a user opens a pop-up menu. The items in the menu function as described in Adding Roles.

The SQL Scripts Panel

Use the SQL Scripts panel to load and modify SQL scripts. If you created your project from an SQLscript and plan to create an ALTER script, you may want to add the original script here, since it will beneeded to create an ALTER script. For more information, see Altering a Schema.

The Model Notes Panel

Use the Model Notes panel to write project notes. Any scripts or notes added will be saved with yourproject.

Page 89: MySQL Workbench

The History Palette

81

The History Palette

Use the History palette to review the actions that you have taken. Left-clicking an entry opens a pop-up menu with the item, Copy History Entries to Clipboard. Choose this item to select a single entry. Youcan select multiple contiguous entries by pressing the Shift key and clicking the entries you wish to copy.Select noncontiguous entries by using the Control key.

Only actions that alter the MySQL model or change an EER diagram are captured by the History palette.

The Model Navigator Panel

Docked at the top left of the application is the Model Navigator, or Bird's Eye panel. This panel providesan overview of the objects placed on an EER diagram canvas and for this reason it is most useful when anEER diagram is active. Any objects that you have placed on the canvas should be visible in the navigator.

The Model Navigator shows the total area of an EER diagram. A black rectangular outline indicates theview port onto the visible area of the canvas. To change the view port of an EER diagram, left-click thisblack outline and drag it to the desired location. You can zoom in on selected areas of an EER diagram byusing the slider tool at the bottom of this window. The dimensions of the view port change as you zoom inand out. If the slider tool has the focus, you can also zoom using the arrow keys.

The default size of the Model Navigator is two pages. To change this, use the Model menu, DiagramSize menu item.

Figure 7.5. The Model Navigator Palette

The Catalog Tree Palette

The Catalog Tree palette shows all the schemata that are present in the Physical Schemata sectionof the MySQL Model page. Expand the view of the objects contained in a specific schema by clicking the +button to the left of the schema name. This displays the following folder icons:

• Tables

• Views

• Routine Groups

Expand each of these in turn by clicking the + button to the left of the folder icon.

Page 90: MySQL Workbench

The Layers Palette

82

Selecting an object in this palette displays its properties in the Properties palette, which can be found inthe lower left corner of the page.

The Catalog Tree palette is primarily used to drag and drop objects onto an EER diagram canvas.

Note

On Linux, there is a quirk in the GTK tree control, where a simple click alwaysgenerates a new selection. To drag multiple objects from the Catalog Tree to theEER diagram canvas, you must perform the operation as follows:

1. Click the first item in the tree.

2. Hold the Shift key, click the last item, and do not release the Shift key.

3. Keep the Shift key depressed and commence the dragging operation.

4. Release the Shift key before you release the mouse button to drop selectedobjects onto the canvas.

This procedure also applies to use of the Control key when selecting multiplenonadjacent elements in the Catalog Tree.

You can toggle the sidebar on and off using the Toggle Sidebar button, which is located in the top right ofthe application.

The Layers Palette

This palette shows all the layers and figures that have been placed on an EER diagram. If a layer or figureis currently selected, an X appears beside the name of the object and its properties are displayed in theProperties palette. This can be especially useful in determining which objects are selected when youhave selected multiple objects using the various options under the Select menu item. For more informationon this topic, see The Edit Menu.

Selecting an object in the Layers palette also adjusts the view port to the area of the canvas where theobject is located.

Finding Invisible Objects Using the Layers Palette

In some circumstances, you may want to make an object on an EER diagram invisible. Select the objectand, in the Properties palette, set the visible property to False.

The Layer palette provides an easy way to locate an object, such as a relationship, that has been set tohidden. Open the Layers palette and select the object by double-clicking it. You can then edit the objectand change its visibility setting to Fully Visible.

The Properties Palette

The Properties palette is used to display and edit the properties of objects on an EER diagram. It isespecially useful for editing display objects such as layers and notes.

All objects except connections have the following properties except as noted:

• color: The color accent of the object, displayed as a hexadecimal value. Change the color of the objectby changing this value. Only characters that are legal for hexadecimal values may be entered. You canalso change the color by clicking the ... button to open a color changer dialog box.

Page 91: MySQL Workbench

EER Diagram Editor

83

• description: Applicable to layers only. A means of documenting the purpose of a layer.

• expanded: This attribute applies to objects such as tables that can be expanded to show columns,indexes, and triggers.

• height: The height of the object. Depending upon the object, this property may be read only or read/write.

• left: The number of pixels from the object to the left side of the canvas.

• locked: Whether the object is locked. The value for this attribute is either true or false.

• manualSizing: Whether the object has been manually sized. The value for this attribute is either trueor false.

• name: The name of the object.

• top: The number of pixels from the object to the top of the canvas.

• visible: Whether the object shows up on the canvas. Use ‘1’ for true and ‘0’ for false. It is currentlyused only for relationships.

• width: The width of the object. Depending upon the object, this property may be read only or read/write.

Tables have the following additional properties:

• indexesExpanded: Whether indexes are displayed when a table is placed on the canvas. Use ‘1’ fortrue and ‘0’ for false.

• triggersExpanded: Whether triggers are displayed when a table is placed on the canvas. Use ‘1’ fortrue and ‘0’ for false.

For a discussion of connection properties, see Connection Properties.

EER Diagram Editor

EER diagrams are created by double-clicking the Add Diagram icon. You may create any number of EERdiagrams just as you may create any number of physical schemata. Each EER diagram shows as a tabbelow the toolbar; a specific EER diagram is selected by clicking its tab.

Clicking an EER diagram tab navigates to the canvas used for graphically manipulating database objects.The Vertical Toolbar is on the left side of this page.

The Vertical Toolbar

The vertical toolbar shows on the left sidebar when an EER diagram tab is selected. The tools on thistoolbar assist in creating EER diagrams.

Page 92: MySQL Workbench

The Vertical Toolbar

84

Figure 7.6. The Vertical Toolbar

Clicking a tool changes the mouse pointer to a pointer that resembles the tool icon, indicating which tool isactive. These tools can also be activated from the keyboard by pressing the key associated with the tool.Hover the mouse pointer over a toolbar icon to display a description of the tool and its shortcut key.

A more detailed description of each of these tools follows.

The Standard Mouse Pointer

The standard mouse pointer, located at the top of the vertical toolbar, is the default mouse pointer for youroperating system. Use this tool to revert to the standard mouse pointer after using other tools.

To revert to the default pointer from the keyboard, use the Esc key.

The Hand Tool

The hand tool is used to move the entire EER diagram. Left-click on this tool and then left-click anywhereon the EER diagram canvas. Moving the mouse while holding down the mouse button changes the viewport of the canvas.

Page 93: MySQL Workbench

The Vertical Toolbar

85

To determine your position on the canvas, look at the Model Navigator panel on the upper right. If theModel Navigator panel is not open, use View, Windows, Model Navigator to open it.

To activate the hand tool from the keyboard, use the H key.

You can also change the view port of an EER diagram using the Model Navigator panel. See TheModel Navigator Panel.

The Eraser Tool

Use the eraser tool to delete objects from the EER Diagram canvas. Change the mouse pointer to theeraser tool, then click the object you wish to delete. Depending upon your settings, the delete dialog boxshould open, asking you to confirm the type of deletion.

Note

The delete action of the eraser tool is controlled by the general option setting fordeletion. Before using the eraser tool, be sure that you understand the availableoptions described in The Model Tab.

To activate the eraser tool from the keyboard, use the D key.

You can also delete an object by selecting it and pressing Control+Delete or by right-clicking it andchoosing Delete from the pop up menu.

The Layer Tool

The layer tool is the rectangular icon with a capital L in the lower left corner. Use the layer tool to organizethe objects on an EER Diagram canvas. It is useful for grouping similar objects. For example, you may useit to group all your views.

Click the layer tool and use it to draw a rectangle on the canvas. Change to the standard mouse pointertool and pick up any objects you would like to place on the newly created layer.

To change the size of a layer, first select it by clicking it. When a layer is selected, small rectangles appearat each corner and in the middle of each side. Adjust the size by dragging any of these rectangles.

You can also make changes to a layer by selecting the layer and changing properties in the Propertiespanel. Using the Properties panel is the only way to change the name of a layer.

To activate the layer tool from the keyboard, use the L key. For more information about layers, seeCreating Layers.

The Text Tool

The text tool is the square icon with a capital N in the top left corner. Use this tool to place text objects onthe EER diagram canvas. Click the tool, then click the desired location on the canvas. After a text objecthas been dropped on the canvas, the mouse pointer reverts to its default.

To add text to a text object, right-click the text object and choose Edit Note... or Edit in New Window... fromthe pop-up menu.

You can manipulate the properties of a text object by selecting it and then changing its properties in theProperties panel.

Page 94: MySQL Workbench

The Vertical Toolbar

86

To activate the text tool from the keyboard, use the N key. For more information about text objects, seeCreating Text Objects.

The Image Tool

Use the image tool to place an image on the canvas. When this tool is selected and you click the canvas, adialog box opens enabling you to select the desired graphic file.

To activate the image tool from the keyboard, use the I key. For more information about images, seeCreating Images.

The Table Tool

Use this tool to create a table on the EER Diagram canvas.

Clicking the canvas creates a table. To edit the table with MySQL Table Editor, right-click it and chooseEdit Table... or Edit in New Window... from the pop-up menu. You can also double-click the table to load itinto the table editor.

To activate the table tool from the keyboard, use the T key.

For more information about creating and editing tables, see The MySQL Table Editor.

The View Tool

Use this tool to create a view on an EER Diagram canvas. When the table tool is activated, a schemalist appears on the toolbar below the main menu, enabling you to associate the new view with a specificschema. You can also select a color for the object by choosing from the color list to the right of the schemalist.

After selecting this tool, clicking the canvas creates a new view. To edit this view, right-click it and chooseEdit View... or Edit in New Window... from the pop-up menu.

To activate the view tool from the keyboard, use the V key.

For more information about creating and editing views, see Creating Views.

The Routine Group Tool

Use this tool to create a routine group on the EER Diagram canvas. When this tool is activated, a schemalist appears on the toolbar below the main menu, enabling you to associate the routine group with aspecific schema. You can also select a color for the routine group by choosing from the color list to theright of the schema list.

After selecting this tool, clicking the canvas creates a new group. To edit this view, right-click it and chooseEdit Routine Group... or Edit in New Window... from the pop-up menu.

To activate the routine group tool from the keyboard, use the G key.

For more information about creating and editing routine groups, see Routine Groups.

The Relationship Tools

The five relationship tools are used to represent the following relationships:

Page 95: MySQL Workbench

Working with Models

87

• One-to-many nonidentifying relationships

• One-to-one nonidentifying relationships

• One-to-many identifying relationships

• One-to-one identifying relationships

• Many-to-many identifying relationships

These tools appear at the bottom of the vertical tool bar. Hover the mouse pointer over each tool to see atext hint that describes its function.

For more information about relationships, see Creating Foreign Key Relationships.

Working with Models

Creating Tables

Adding Tables to the Physical Schemata

Double-clicking the Add table icon in the Physical Schemata section of the MySQL Model pageadds a table with the default name of table1. If a table with this name already exists, the new table isnamed table2.

Adding a new table automatically opens the table editor docked at the bottom of the application. Forinformation about using the table editor, see The MySQL Table Editor.

Right-clicking a table opens a pop-up menu with the following items:

• Cut 'table_name'

• Copy 'table_name'

• Edit Table...

• Edit in New Window...

• Copy SQL to Clipboard

• Copy Insert to Clipboard: Copies INSERT statements based on the model's inserts. Nothing is copied tothe clipboard if the table has no inserts defined.

• Copy Insert Template to Clipboard: Copies a generic INSERT statement that is based on the model.

• Delete 'table_name'

If the table editor is not open, the Edit Table... item opens it. If it is already open, the selected tablereplaces the previous one. Edit in New Window... opens a new table editor tab.

The cut and copy items are useful for copying tables between different schemata.

Warning

Use the Delete 'table_name' item to remove a table from the database. There willbe no confirmation dialog box.

Page 96: MySQL Workbench

Creating Tables

88

Any tables added to the Physical Schemata section also show up in the Catalog palette on the rightside of the application. They may be added to an EER Diagram by dragging and dropping them from thispalette.

Adding Tables to an EER Diagram

Tables can also be added to an EER Diagram using the table tool on the vertical toolbar. Make sure thatthe EER Diagram tab is selected, then right-click the table icon on the vertical toolbar. The table icon is therectangular tabular icon.

Clicking the mouse on this icon changes the mouse pointer to a table pointer. You can also change themouse pointer to a table pointer by pressing the T key.

Choosing the table tool changes the contents of the toolbar that appears immediately below the menubar. When the Tables pointer is active, this toolbar contains a schemata list, an engines list, a collationslist, and a color chart list. Use these lists to select the appropriate schema, engine, collation, and coloraccent for the new table. Make sure that you associate the new table with a database. The engine andcollation of a table can be changed using the table editor. The color of your table can be changed usingthe Properties palette. The Default Engine and Default Collation values refer to the databasedefaults.

Create a table by clicking anywhere on the EER Diagram canvas. This creates a new table with the defaultname table1. To revert to the default mouse pointer, click the arrow icon at the top of the vertical toolbar.

Page 97: MySQL Workbench

Creating Tables

89

Figure 7.7. A Table on an EER Diagram

Page 98: MySQL Workbench

Creating Tables

90

As shown in the preceding diagram, the primary key is indicated by a key icon and indexed fields areindicated by a different colored diamond icon. Click the arrow to the right of the table name to toggle thedisplay of the fields. Toggle the display of indexes and triggers in the same way.

Right-clicking a table opens a pop-up menu with the following items:

• Cut 'table_name'

• Copy 'table_name'

• Edit Table...

• Edit in New Window...

• Copy SQL to Clipboard

• Copy Insert to Clipboard

• Delete 'table_name'

With the exception of the deletion item, these menu items function as described in Adding Tables to thePhysical Schemata. The behavior of the delete option is determined by your MySQL Workbench optionssettings. For more information, see The Model Tab.

The MySQL Table Editor

The MySQL Table Editor is a component that enables the creation and modification of tables. You can addor modify a table's columns or indexes, change the engine, add foreign keys, or alter the table's name.

The MySQL Table Editor can be accessed in several ways, and most commonly by right-clicking on atable name within the Object Viewer and choosing ALTER TABLE. This will open a new tab within themain SQL Editor window. You can also access the MySQL Table Editor from an EER Diagram by double-clicking a table object.

The Main Editor Window

Any number of tables may be edited in the MySQL Table Editor at any one time. Adding another tablecreates a new tab at the top of the editor. By default, the MySQL Table Editor appears docked at the top ofthe table editor tab, within the SQL editor..

The MySQL Table Editor is shown on top of the following figure.

Page 99: MySQL Workbench

Creating Tables

91

Figure 7.8. The Table Editor

Page 100: MySQL Workbench

Creating Tables

92

The MySQL Table Editor provides a work space that has tabs used to perform these actions:

• Columns: Add or modify columns

• Indexes: Add or modify indexes

• Foreign Keys: Add or modify foreign keys

• Triggers: Add or modify triggers

• Partitioning: Manage partitioning

• Options: Add or modify various general, table, and row options

The following sections discuss these tabs in further detail.

The Columns Tab

Use the Columns tab to display and edit all the column information for a table. With this tab, you can add,drop, and alter columns.

You can also use the Columns tab to change column properties such as name, data type, and defaultvalue.

Figure 7.9. The Columns Tab

Right-click a row under the Column Name column to open a pop-up menu with the following items:

• Move Up: Move the selected column up.

Page 101: MySQL Workbench

Creating Tables

93

• Move Down: Move the selected column down.

• Delete Selected Columns: Select multiple contiguous columns by right-clicking and pressing the Shiftkey. Use the Control key to select noncontiguous columns.

• Refresh: Update all information in the Columns tab.

• Clear Default: Clear the assigned default value.

• Default NULL: Set the column default value to NULL.

• Default 0: Set the column default value to 0.

• Default CURRENT_TIMESTAMP: Available for TIMESTAMP data types.

• Default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP: Available for TIMESTAMP datatypes.

To add a column, click the Column Name field in an empty row and enter an appropriate value. Select adata type from the Datatype list. Select a column property check box as required according to the followinglist of column properties:

• PK: Primary key

• NN: Not null

• UQ: Unique

• BIN: Binary

• UN: Unsigned

• ZF: Zerofill

• AI: Auto-increment

To change the name, data type, default value, or comment of a column, double-click the value you wish tochange. The content then becomes editable.

You can also add column comments to the Column Comment field. It is also possible to set the columncollation, using the list in the Column Details panel.

To the left of the column name is an icon that indicates whether the column is a member of the primarykey. If the icon is a small key, that column belongs to the primary key, otherwise the icon is a blue diamondor a white diamond. A blue diamond indicates the column has NN set. To add or remove a column from theprimary key, double-click the icon. You can also add a primary key by checking the PRIMARY KEY checkbox in the Column Details section of the table editor.

If you wish to create a composite primary key you can select multiple columns and check the PK checkbox. However, there is an additional step that is required, you must click the Indexes tab, then in the IndexColumns panel you must set the desired order of the primary keys.

Note

When entering default values, in the case of CHAR and VARCHAR data types MySQLWorkbench will attempt to automatically add quotation marks, if the user does notstart their entry with one. For other data types the user must manage quoting ifrequired, as it will not be handled automatically by MySQL Workbench.

Page 102: MySQL Workbench

Creating Tables

94

Caution

Care must be taken when entering a default value for ENUM columns becausea nonnumeric default will not be automatically quoted. You must manually addsingle quote characters for the default value. Note that MySQL Workbench will notprevent you from entering the default value without the single quotation marks. If anonnumeric default value is entered without quotation marks, this will lead to errors.For example, if the model is reverse engineered, the script will contain unquoteddefault values for ENUM columns and will fail if an attempt is made to run the scripton MySQL Server.

The Indexes Tab

The Indexes tab holds all index information for your table. Use this tab to add, drop, and modify indexes.

Figure 7.10. The Indexes Tab

Select an index by right-clicking it. The Index Columns section displays information about the selectedindex.

Page 103: MySQL Workbench

Creating Tables

95

To add an index, click the last row in the index list. Enter a name for the index and select the index typefrom the list. Select the column or columns that you wish to index by checking the column name in theIndex Columns list. You can remove a column from the index by removing the check mark from theappropriate column.

You can also specify the order of an index by choosing ASC or DESC under the Order column. Create anindex prefix by specifying a numeric value under the Length column. You cannot enter a prefix value forfields that have a data type that does not support prefixing.

To drop an index, right-click the row of the index you wish to delete, then select the Delete SelectedIndexes menu item.

The Foreign Keys Tab

The Foreign Keys tab is organized in much the same fashion as the Indexes tab and adding or editing aforeign key is similar to adding or editing an index.

Figure 7.11. The Foreign Keys Tab

To add a foreign key, click the last row in the Foreign Key Name list. Enter a name for the foreign keyand select the column or columns that you wish to index by checking the column name in the Column list.You can remove a column from the index by removing the check mark from the appropriate column.

Under Foreign Key Options, choose an action for the update and delete events. The options are:

• RESTRICT

• CASCADE

Page 104: MySQL Workbench

Creating Tables

96

• SET NULL

• NO ACTION

To drop a foreign key, right-click the row you wish to delete, then select the Delete Selected FKs menuitem.

To modify properties of a foreign key, select it and make the desired changes.

The Triggers Tab

The Triggers tab opens a field for editing an existing trigger or creating a new trigger. Create a trigger asyou would from the command line.

Figure 7.12. The Triggers Tab

The Partitioning Tab

To enable partitioning for your table, check the Enable Partitioning check box. This enables thepartitioning options.

Page 105: MySQL Workbench

Creating Tables

97

Figure 7.13. The Partitioning Tab

The Partition By pop-up menu displays the types of partitions you can create:

• HASH

• LINEAR HASH

• KEY

• LINEAR KEY

• RANGE

• LIST

Use the Parameters field to define any parameters to be supplied to the partitioning function, such as aninteger column value.

Choose the number of partitions from the Partition Count list. To manually configure your partitions, checkthe Manual check box. This enables entry of values into the partition configuration table. The entries in thistable are:

• Partition

• Values

• Data Directory

• Index Directory

• Min Rows

Page 106: MySQL Workbench

Creating Tables

98

• Max Rows

• Comment

Subpartitioning is also available. For more information about partitioning, see Partitioning.

The Options Tab

The Options tab enables you to set several types of options.

Figure 7.14. The Options Tab

which are grouped into the following sections:

• General Options

• Row Options

• Storage Options

• Merge Table options

The following discussion describes these options in more detail.

General Options Section

Page 107: MySQL Workbench

Creating Tables

99

In the General Options section, choose a pack keys option. The options are Default, Pack None, andPack All. You may also encrypt the definition of a table. The AUTO_INCREMENT and delayed key updatebehaviors apply only to MyISAM tables.

Row Options Section

To set the row format, choose the desired row format from the list. For more information about the differentrow formats that are available, see <literal>MyISAM</literal> Table Storage Formats.

These options are:

• Default

• Dynamic

• Fixed

• Compressed

• Redundant

• Compact

When you expect a table to be particularly large, use the Avg. Row, Min. Rows, and Max. Rows optionsto enable the MySQL server to better accommodate your data. See <literal>CREATE TABLE</literal>Syntax for more information on how to use these options.

Storage Options Section

The Storage Options section is available only for MyISAM tables. Use it to configure a custom path tothe table storage and data files. This can help improve server performance by locating different tables ondifferent hard drives.

Merge Table Options Section

Use the Merge Table Options section to configure MERGE tables. To create a MERGE table, select MERGEas your storage engine and then specify the MyISAM tables you wish to merge in the Union Tables dialog.

You may specify the action the server should take when users attempt to perform INSERT statements onthe merge table. You may also select the Merge Method by selecting from the list. For more informationabout MERGE tables, see The <literal>MERGE</literal> Storage Engine.

The Inserts Tab

Use the Inserts tab to insert rows into the table.

To edit a row, click the field you wish to change and enter the new data. Right-clicking a row displays amenu with the following items:

• Set Field(s) to NULL: Set the column value to NULL.

• Delete Row(s): Delete the selected row or rows.

• Copy Row Content: Copies the row to the clipboard. Strings are copied quoted, and NULL values arepreserved.

• Copy Row Content (unquoted): Copies the row to the clipboard. Strings are not quoted and NULL arecopied as a space.

• Copy Field Content: Copies the value of the selected field to the clipboard. Strings are quoted.

Page 108: MySQL Workbench

Creating Tables

100

• Copy Field Content (unquoted): Copies the value of the selected field to the clipboard. Strings are notquoted.

Note that the insert editor features a toolbar. This has the same functionality as explained in ResultsTabsheets and Live Editing Tabsheets. You can also hover the cursor over the toolbar to display tooltips.

Any rows you add will be inserted when you forward engineer the database (if you choose the GenerateINSERT statements for tables option).

Note

When entering string values that there is slightly different behavior between the 5.0,5.1, and 5.2 versions of MySQL Workbench.

For 5.0 and 5.1, if a string is entered without leading and trailing quotation marks,the Inserts Editor adds quoting and escapes characters that require it. However, ifquoted text is entered, the Inserts Editor performs no further checks and assumesthat a correctly escaped and quoted sequence has been entered.

5.2 features a new Inserts Editor. In this case, the user enters the string withoutquoting or escaping and the Inserts Editor takes care of all quoting and escaping asrequired.

Note

It is possible to enter a function, or other expression, into a field. Use the prefix\func to prevent MySQL Workbench from escaping quotation marks. For example,for the expression md5('fred'), MySQL Workbench normally would generatethe code md5(\'fred\'). To prevent this, enter the expression as \funcmd5('fred') to ensure that the quoting is not escaped.

The Privileges Tab

Use the Privileges tab to assign specific roles and privileges to a table. You may also assign privileges toa role using the role editor. For a discussion of this topic, see Adding Roles.

When this tab is first opened, all roles that have been created are displayed in the list on the right. Movethe roles you wish to associate with this table to the Roles list on the left. Do this by selecting a role andthen clicking the < button. Use the Shift key to select multiple contiguous roles and the Control key toselect noncontiguous roles.

To assign privileges to a role, click the role in the Roles list. This displays all available privileges in theAssigned Privileges list. The privileges that display are:

• ALL

• CREATE

• DROP

• GRANT OPTION

• REFERENCES

• ALTER

• DELETE

Page 109: MySQL Workbench

Creating Foreign Key Relationships

101

• INDEX

• INSERT

• SELECT

• UPDATE

• TRIGGER

You can choose to assign all privileges to a specific user or any other privilege as listed previously.Privileges irrelevant to a specific table, such as the FILE privilege, are not shown.

If a role has already been granted privileges on a specific table, those privileges show as already checkedin the Assigned Privileges list.

Creating Foreign Key Relationships

Foreign key constraints are supported for the InnoDB storage engine only. For other storage engines, theforeign key syntax is correctly parsed but not implemented. For more information, see Foreign Keys.

Using MySQL Workbench you may add a foreign key from within the table editor or by using therelationship tools on the vertical toolbar of an EER Diagram. This section deals with adding a foreign keyusing the foreign key tools. To add a foreign key using the table editor, see The Foreign Keys Tab.

The graphical tools for adding foreign keys are most effective when you are building tables from the groundup. If you have imported a database using an SQL script and need not add columns to your tables, youmay find it more effective to define foreign keys using the table editor.

Adding Foreign Key Relationships Using an EER Diagram

The vertical toolbar on the left side of an EER Diagram has six foreign key tools:

• one-to-one non-identifying relationship

• one-to-many non-identifying relationship

• one-to-one identifying relationship

• one-to-many identifying relationship

• many-to-many identifying relationship

• Place a Relationship Using Existing Columns

An identifying relationship is one where the child table cannot be uniquely identified without its parent.Typically this occurs where an intermediary table is created to resolve a many-to-many relationship. Insuch cases, the primary key is usually a composite key made up of the primary keys from the two originaltables. An identifying relationship is indicated by a solid line between the tables and a nonidentifyingrelationship is indicated by a broken line.

Create or drag and drop the tables that you wish to connect. Ensure that there is a primary key in the tablethat will be on the “one” side of the relationship. Click on the appropriate tool for the type of relationship youwish to create. If you are creating a one-to-many relationship, first click the table that is on the “many” sideof the relationship, then on the table containing the referenced key. This creates a column in the table onthe many side of the relationship. The default name of this column is table_name_key_name where thetable name and the key name both refer to the table containing the referenced key.

Page 110: MySQL Workbench

Creating Foreign Key Relationships

102

When the many-to-many tool is active, double-clicking a table creates an associative table with a many-to-many relationship. For this tool to function there must be a primary key defined in the initial table.

Use the Model menu, Menu Options menu item to set a project-specific default name for the foreign keycolumn (see The Relationship Notation Submenu). To change the global default, see The Model Tab.

To edit the properties of a foreign key, double-click anywhere on the connection line that joins the twotables. This opens the relationship editor.

Mousing over a relationship connector highlights the connector and the related keys as shown in thefollowing figure. The film and the film_actor tables are related on the film_id field and these fieldsare highlighted in both tables. Since the film_id field is part of the primary key in the film_actor table,a solid line is used for the connector between the two tables.

Figure 7.15. The Relationship Connector

If the placement of a connection's caption is not suitable, you can change its position by dragging it toa different location. If you have set a secondary caption, its position can also be changed. For moreinformation about secondary captions, see Connection Properties. Where the notation style permits,Classic for example, the cardinality indicators can also be repositioned.

The relationship notation style in Figure 7.15, “The Relationship Connector” is the default, crow's foot. Youcan change this if you are using a commercial version of MySQL Workbench. For more information, seeThe Relationship Notation Submenu.

Page 111: MySQL Workbench

Creating Foreign Key Relationships

103

You can select multiple connections by holding down the Control key as you click a connection. This canbe useful for highlighting specific relationships on an EER diagram.

The Relationship Editor

Double-clicking a relationship on the EER diagram canvas opens the relationship editor. This has two tabs:Relationship, and Foreign Key.

The Relationship Tab

In the Relationship tab, you can set the caption of a relationship using the Caption field. This namedisplays on the canvas and is also the name used for the constraint itself. The default value for this nameis fk_source_table_destination_table. Use the Model menu, Menu Options menu item to set aproject-specific default name for foreign keys. To change the global default, see The Model Tab.

You can also add a secondary caption and a caption to a relationship.

The Visibility Settings section is used to determine how the relationship is displayed on the EER Diagramcanvas. Fully Visible is the default but you can also choose to hide relationship lines or to use splitlines. The split line style is pictured in the following figure.

Figure 7.16. The Split Connector

Page 112: MySQL Workbench

Creating Foreign Key Relationships

104

Note

A broken line connector indicates a nonidentifying relationship. The split line stylecan be used with either an identifying relationship or a nonidentifying relationship. Itis used for display purposes only and does not indicate anything about the nature ofa relationship.

To set the notation of a relationship use the Model menu, Relationship Notation menu item. For moreinformation, see The Relationship Notation Submenu.

The Foreign Key Tab

The Foreign Key tab contains several sections: Referencing Table, Cardinality and Referenced Table.

The Mandatory check boxes are used to select whether the referencing table and the referenced table aremandatory. By default, both of these constraints are true (indicated by the check boxes being checked).

The Cardinality section has a set of radio buttons that enable you to choose whether the relationship isone-to-one or one-to-many. There is also a check box that enables you to specify whether the relationshipis an identifying relationship.

Connection Properties

Right-click a connection to select it. When a connection is selected, it is highlighted and its properties aredisplayed in the properties palette. Connection properties are quite different from the properties of otherobjects. The following list describes them:

• caption: The name of the connection. By default, the name is the name of the foreign key and theproperty is centered above the connection line.

• captionXOffs: The X offset of the caption.

• captionYOffs: The Y offset of the caption.

• comment: The comment associated with the relationship.

• drawSplit: Whether to show the relationship as a continuous line.

• endCaptionXOffs: The X termination point of the caption offset.

• endCaptionYOffs: The Y termination point of the caption offset.

• extraCaption: A secondary caption. By default, this extra caption is centered beneath the connectionline.

• extraCaptionXOffs: The X offset of the secondary caption.

• extraCaptionYOffs: The Y offset of the secondary caption.

• mandatory: Whether the entities are mandatory. For more information, see The Relationship Editor.

• many: False if the relationship is a one-to-one relationship.

• middleSegmentOffset: The offset of the middle section of the connector.

• modelOnly: Set when the connection will not be propagated to the DDL. It is just a logical connectiondrawn on a diagram. This is used, for example, when drawing MyISAM tables with a visual relationship,but with no foreign keys.

Page 113: MySQL Workbench

Creating Views

105

• name: The name used to identify the connection on the EER Diagram canvas. Note that this is not thename of the foreign key.

• referredMandatory: Whether the referred entity is mandatory.

• startCaptionXOffs: The start of the X offset of the caption.

• startCaptionYOffs: The start of the Y offset of the caption.

In most cases, you can change the properties of a relationship using the relationship editor rather than theProperties palette.

If you make a relationship invisible by hiding it using the relationship editor's Visibility Settings, and thenclose the relationship editor, you will no longer be able to select the relationship to bring up its relationshipeditor. To make the relationship visible again, you must expand the table object relating to the relationshipin the Layers palette and select the relationship object. To edit the selected object, right-click it, then selectEdit Object. You can then set the Visibility Settings to Fully Visible. The relationship will then be visiblein the EER Diagram window.

Creating Views

You can add views to a database either from the Physical Schemata section of the MySQL Modelpage or from the EER Diagram.

Adding Views to the Physical Schemata

To add a view, double-clicking the Add View icon in the Physical Schemata section of the MySQLModel page. The default name of the view is view1. If a view with this name already exists, the new viewis named view2.

Adding a new view automatically opens the view editor docked at the bottom of the application. Forinformation about using the view editor, see The View Editor.

Right-clicking a view opens a pop-up menu with the following items:

• Cut 'view_name'

• Copy 'view_name'

• Paste

• Edit View...

• Edit in New Window...

• Copy SQL to Clipboard

• Delete 'view_name'

If the table editor is not open, the Edit View... item opens it. If it is already open, the selected table replacesthe previous one. Edit in New Window... opens a new view editor tab.

The cut and copy items are useful for copying views between different schemata. Copy SQL to Clipboardcopies the CREATE VIEW statement to the clipboard.

Warning

Use the Delete 'view_name' item to remove a view from the database. There willbe no confirmation dialog box.

Page 114: MySQL Workbench

Creating Views

106

Any views added to the Physical Schemata section also show up in the Catalog palette on theleft side of the application. They may be added to an EER Diagram, when in the EER Diagram tab, bydragging and dropping them from this palette.

Adding Views to an EER Diagram

Views can also be added to an EER Diagram using the View tool on the vertical toolbar. Make sure thatthe EER Diagram tab is selected, then left-click the view icon on the vertical toolbar. The view icon is thetwo overlapping rectangles found below the table icon.

Clicking this icon changes the mouse pointer to a view pointer. To change the mouse pointer to a viewpointer from the keyboard, use the V key.

Choosing the View tool changes the contents of the toolbar that appears immediately below the mainmenu bar. When the Views pointer is active, this toolbar contains a schemata list and a color chart list.Use these lists to select the appropriate schema and color accent for the new view. Make sure that youassociate the new view with a database. The color of your view can be changed using the Propertiespalette.

Create a view by clicking anywhere on the EER Diagram canvas. This creates a new view with the defaultname view1. To revert to the default mouse pointer, click the arrow icon at the top of the vertical toolbar.

Right-clicking a view opens a pop-up menu. With the exception of the delete item, these menu itemsfunction as described in Adding Views to the Physical Schemata. The behavior of the delete option isdetermined by your MySQL Workbench options settings. For more information, see The Model Tab.

The View Editor

To invoke the view editor, double-click a view object on the EER Diagram canvas or double-click a view inthe Physical Schemata section on the MySQL Model page. This opens the view editor docked at thebottom of the application. Double-clicking the title bar undocks the editor. Do the same to redock it. Anynumber of views may be open at the same time. Each additional view appears as a tab at the top of theview editor.

There are three tabs at the bottom of the view editor: View, Comments, and Privileges. Navigate betweendifferent tabs using the mouse or from the keyboard by pressing Control+Alt+Tab.

The View Tab

Use the View tab to perform the following tasks:

• Rename the view using the Name text box.

• Enter the SQL to create a view using the SQL field.

• Comment a view using the Comments text area.

The Comments Tab

This tab enables you to enter comments for a particular view.

The Privileges Tab

The Privileges tab of the view editor functions in exactly the same way as the Privileges tab of the tableeditor. For more information, see The Privileges Tab.

Page 115: MySQL Workbench

Creating Routines and Routine Groups

107

Modifying a View Using the Properties Palette

When you select a view on the EER Diagram canvas, its properties are displayed in the Propertiespalette. Most of the properties accessible from the Properties palette apply to the appearance of a viewon the EER Diagram canvas.

For a list of properties accessible through the Properties palette, see The Properties Palette.

Creating Routines and Routine Groups

You can add Routine Groups to a database either from the Physical Schemata section of the MySQLModel page or from an EER Diagram. Routines may be added only from the Physical Schemata sectionof the MySQL Model page.

To view an existing schema, along with its Routines and Routine Groups, choose Database, ReverseEngineer... from the main menu. After the schema has been added to the current model, you can see theschema objects on the Physical Schemata panel on the MySQL Model page. The Routines and RoutineGroups are listed there.

MySQL Workbench unifies both stored procedures and stored functions into one logical object called aRoutine. Routine Groups are used to group routines that are related. You can decide how many RoutineGroups you want to create and you can use the Routine Group Editor to assign specific routines to agroup, using a drag and drop interface.

When designing an EER Diagram, you can place the Routine Groups on the canvas by dragging themfrom the Catalog Palette. Placing individual routines on the diagram is not permitted, as it would clutter thecanvas.

Routines

Adding Routines to the Physical Schemata

To add a routine, double-click the Add Routine icon in the Physical Schemata section of the MySQLModel page. The default name of the routine is routine1. If a routine with this name already exists, thenew routine is named routine2.

Adding a new routine automatically opens the routine editor docked at the bottom of the application. Forinformation about using the routine editor, see The Routine Editor.

Right-clicking a routine opens a pop-up menu with the following items:

• Rename

• Cut 'routine_name'

• Copy 'routine_name'

• Paste

• Edit Routine...

• Edit in New Window...

• Copy SQL to Clipboard

• Delete 'routine_name'

Page 116: MySQL Workbench

Creating Routines and Routine Groups

108

The Edit Routine... item opens the routine editor.

The cut and paste items are useful for copying routines between different schemata.

Note

Deleting the code for a routine from the Routines tab of the Routine Group Editorresults in removal of the routine object from the model.

Note

To remove a routine from a routine group, use the controls on the Routine Grouptab of the Routine Group Editor.

The action of the delete option varies depending upon how you have configured MySQL Workbench. Formore information, see The Model Tab.

The Routine Editor

To invoke the routine editor, double-click a routine in the Physical Schemata section on the MySQLModel page. This opens the routine editor docked at the bottom of the application. Any number of routinesmay be open at the same time. Each additional routine appears as a tab at the top of the routine editor.

Routine and Privileges tabs appear at the bottom of the routine editor. Navigate between different tabsusing the mouse or from the keyboard by pressing Control+Alt+Tab.

The Routine Tab

Use the Routine tab of the routine editor to perform the following tasks:

• Rename the routine using the Name field.

• Enter the SQL to create a routine using the SQL field.

The Privileges Tab

The Privileges tab of the routine editor functions in exactly the same way as the Privileges tab of the tableeditor. For more information, see The Privileges Tab.

Note

Privileges are available only in the Standard Edition of MySQL Workbench.

Routine Groups

Adding Routine Groups to the Physical Schemata

Double-clicking the Add Routine Group icon in the Physical Schemata section of the MySQL Modelpage adds a routine group with the default name of routines1. If a routine group with this name alreadyexists, the new routine group is named routines2.

Adding a new routine group automatically opens the routine groups editor docked at the bottom of theapplication. For information about using the routine groups editor, see The Routine Group Editor.

Right-clicking a routine group opens a pop-up menu with the following items:

Page 117: MySQL Workbench

Creating Routines and Routine Groups

109

• Rename

• Cut 'routine_group_name'

• Copy 'routine_group_name'

• Edit Routine...

• Edit in New Window...

• Copy SQL to Clipboard

• Delete 'routine_group_name'

The Edit Routine Group... item opens the routine group editor, which is described in The Routine GroupEditor.

The cut and paste items are useful for copying routine groups between different schemata.

Deleting a routine group from the MySQL Model page removes the group but does not remove anyroutines contained in that group.

Any routine groups added to the Physical Schemata also show up in the Catalog palette on the rightside of the application. They may be added to an EER Digram by dragging and dropping them from thispalette.

Adding Routine Groups to an EER Diagram

To add routine groups to an EER Diagram, use the Routine Groups tool on the vertical toolbar. Makesure that the EER Diagram tab is selected, then right-click the routine groups icon on the vertical toolbar.The routine groups icon is immediately above the lowest toolbar separator.

Clicking the mouse on this icon changes the mouse pointer to a routine group pointer. You can alsochange the mouse pointer to a routine pointer by pressing the G key.

Choosing the Routine Group tool changes the contents of the toolbar that appears immediately belowthe menu bar. When the Routine Groups pointer is active, this toolbar contains a schemata list and acolor chart list. Use these lists to select the appropriate schema and color accent for the new routine group.Make sure that you associate the new routine group with a database. The color of your routine group canbe changed later using the Properties palette.

Create a routine group by clicking anywhere on the EER Diagram canvas. This creates a new routinegroup with the default name routines1. To revert to the default mouse pointer, click the arrow icon at thetop of the vertical toolbar.

Right-clicking a routine group opens a pop-up menu. With the exception of the delete option and renameoptions, these menu options function as described in Adding Routine Groups to the Physical Schemata.There is no rename option, and the behavior of the delete option is determined by your MySQL Workbenchoptions settings. For more information, see The Model Tab.

The Routine Group Editor

To invoke the routine group editor, double-click a routine group object on the EER Diagram canvas ordouble-click a routine group in the Physical Schemata section on the MySQL Model page. This opensthe routine group editor docked at the bottom of the application. Double-clicking the title bar undocksthe editor. Do the same to redock it. Any number of routine groups may be open at the same time. Eachadditional routine group appears as a tab at the top of the routine editor,

Page 118: MySQL Workbench

Creating Layers

110

Routine group and Privileges tabs appear at the bottom of the routine editor. Navigate between differenttabs using the mouse or from the keyboard by pressing Control+Alt+Tab.

The Routine Groups Tab

Use the Routine Groups tab of the routine groups editor to perform the following tasks:

• Rename the routine group using the Name field.

• Add routines to the group by dragging and dropping them.

• Add comments to the routine group.

The Privileges Tab

The Privileges tab of the routine group editor functions in exactly the same way as the Privileges tab ofthe table editor. For more information, see The Privileges Tab.

Note

Privileges are available only in the Standard Edition of MySQL Workbench.

Modifying a Routine Group Using the Properties Palette

When you select a routine group on the EER Diagram canvas, its properties are displayed in theProperties palette. All of the properties accessible from the Properties palette apply to theappearance of a routine group on the EER Diagram canvas.

For a list of properties accessible through the Properties palette, see The Properties Palette.

Creating Layers

You can add layers to a database only from an EER Diagram. Layers are used to help organize objects onthe canvas. Typically, related objects are added to the same layer; for example, you may choose to add allyour views to one layer.

Adding Layers to an EER Diagram

To add layers to an EER Diagram, use the Layer tool on the vertical toolbar. Select an EER Diagram taband right-click the layer icon on the vertical toolbar. The layer icon is the rectangle with an ‘L’ in the lowerleft corner and it is found below the eraser icon.

Clicking the mouse on this icon changes the mouse pointer to a layer pointer. You can also change themouse pointer to a layer pointer by pressing the L key.

Choosing the Layer tool changes the contents of the toolbar that appears immediately below the menubar. When the Layers pointer is active, this toolbar contains a color chart list. Use this list to select thecolor accent for the new layer. The color of your layer can be changed later using the Properties palette.

Create a layer by clicking anywhere on the EER Diagram canvas and, while holding the left mouse buttondown, draw a rectangle of a suitable size. This creates a new layer with the default name layer1. Torevert to the default mouse pointer, click the arrow icon at the top of the vertical toolbar.

The following image shows a layer containing a number of views.

Page 119: MySQL Workbench

Creating Layers

111

Figure 7.17. The Layer Object

To change the name of a layer, use the name property of the Properties palette.

Right-clicking a layer opens a pop-up menu with the following items:

• Cut 'layer_name'

• Copy 'layer_name'

• Delete 'layer_name'

The cut and copy items are useful for copying layers between different schemata.

Since layers are not schema objects, no confirmation dialog box opens when you delete a layer regardlessof how you have configured MySQL Workbench. Deleting a layer does not delete schema objects from thecatalog.

Adding Objects to a Layer

To add an object to a layer, drag and drop it directly from the Catalog palette onto a layer. If you pick upan object from an EER diagram, you must press Control as you drag it onto the layer, otherwise it will notbe “locked” inside the layer.

Locking objects to a layer prevents their accidental removal. You cannot remove them by clicking anddragging; to remove an object, you also must press the Control key while dragging it.

As a visual cue that the object is being “locked”, the outline of the layer is highlighted as the object isdragged over it.

If you drag a layer over a table object, the table object will automatically be added to the layer. This alsoworks for multiple table objects.

Layers cannot be nested. That is, a layer cannot contain another layer object.

Modifying a Layer Using the Properties Palette

When you select a layer on the EER Diagram canvas, its properties are displayed in the Propertiespalette. The properties accessible from the Properties palette apply to the appearance of a layer on theEER Diagram canvas.

Page 120: MySQL Workbench

Creating Notes

112

In some circumstances, you may want to make a layer invisible. Select the layer and, in the Propertiespalette, set the visible property to False. To locate an invisible object, open the Layers palette andselect the object by double-clicking it. After an object is selected, you can reset the visible property fromthe Properties palette.

For a list of properties accessible through the Properties palette, see The Properties Palette. In additionto the properties listed there, a layer also has a description property. Use this property to document thepurpose of the layer.

Creating Notes

You can add notes to a database only from the Model Notes section of the MySQL Model page. Notesare typically used to help document the design process.

Adding Notes

Double-clicking the Add Note icon in the Model Notes section of the MySQL Model page adds a notewith the default name of note1. If a note with this name already exists, the new note is named note2.

Adding a new note automatically opens the note editor docked at the bottom of the application. Forinformation about using the note editor, see The Note Editor.

Right-clicking a note opens a pop-up menu with the following items:

• Rename

• Cut 'note_name'

• Copy 'note_name'

• Delete 'note_name'

The Edit Note... item opens the note editor. For information about using the note editor, see The NoteEditor.

The cut and copy items are useful for copying notes between different schemata.

Notes can be added only on the MySQL Model page.

The Note Editor

To invoke the note editor, double-click a note object in the Model Note section on the MySQL Modelpage. This opens the note editor docked at the bottom of the application. Double-clicking the note tabundocks the editor. Double-click the title bar to redock it. Any number of notes may be open at the sametime. Each additional note appears as a tab at the top of the note editor.

Use the editor to change the name of a note or its contents.

Creating Text Objects

Text objects are applicable only to an EER diagram. They can be used for documentation purposes; forexample, to explain a grouping of schema objects. They are also useful for creating titles for an EERdiagram should you decide to export a diagram as a PDF or PNG file.

Adding Text Objects to an EER Diagram

To add text objects to an EER Diagram, use the Text Object tool on the vertical toolbar. Make sure thatthe EER Diagram tab is selected, then right-click the text object icon on the vertical toolbar. The text objecticon is the rectangular icon found below the label icon.

Page 121: MySQL Workbench

Creating Images

113

Clicking the mouse on this icon changes the mouse pointer to a text object pointer. You can also changethe mouse pointer to a text object pointer by pressing the N key.

Choosing the Text Object tool changes the contents of the toolbar that appears immediately below themenu bar. When the Text Object pointer is active, this toolbar contains a color chart list. Use this list toselect the color accent for the new text object. The color of your text object can be changed later using theProperties palette.

Create a text object by clicking anywhere on the EER Diagram canvas. This creates a new text objectwith the default name text1. To revert to the default mouse pointer, click the arrow icon at the top of thevertical toolbar.

Right-clicking a text object opens a pop-up menu. These menu options are identical to the options for otherobjects. However, since a text object is not a database object, there is no confirmation dialog box whenyou delete a text object.

The Text Object Editor

To invoke the text object editor, double-click a text object on the EER Diagram canvas. This opens theeditor docked at the bottom of the application. Double-clicking the text object table undocks the editor.Double-click the title bar to redock it. Any number of text objects may be open at the same time. Eachadditional text objects appears as a tab at the top of the text editor.

Use the editor to change the name of a text object or its contents.

Modifying a Text Object Using the Properties Palette

When you select a text object on the EER Diagram canvas, its properties are displayed in theProperties palette. Most of the properties accessible from the Properties palette apply to theappearance of a view on the EER Diagram canvas.

For a list of properties accessible through the Properties palette, see The Properties Palette.

There is no property in the Properties palette for changing the font used by a text object. To do so,choose the Appearance tab of the Workbench Preferences dialog. For more information, see TheAppearance Tab.

Creating Images

Images exist only on the EER Diagram canvas; you can add them only from the EER Diagram window.

Adding Images to an EER Diagram

To add images to an EER Diagram, use the Image tool on the vertical toolbar. Make sure that the EERDiagram tab is selected, then right-click the image icon on the vertical toolbar. The image icon is the iconjust above the table icon.

Clicking the mouse on this icon changes the mouse pointer to an image pointer. You can also change themouse pointer to an image pointer by pressing the I key.

Create an image by clicking anywhere on the EER Diagram canvas. This opens a file open dialog box.Select the desired image, then close the dialog box to create an image on the canvas. To revert to thedefault mouse pointer, click the arrow icon at the top of the vertical toolbar.

Right-clicking this object opens a pop-up menu with the following items:

• Cut 'Image'

• Copy 'Image'

Page 122: MySQL Workbench

Reverse Engineering

114

• Edit Image...

• Edit in New Window...

• Delete 'Image'

These menu items function in exactly the same way as they do for other objects on an EER diagram.However, images are not database objects so there is no confirmation dialog box when they are deleted.

The Image Editor

To invoke the image editor, double-click an image object on an EER Diagram canvas. This opens theimage editor docked at the bottom of the application. Double-clicking the image editor tab undocks theeditor. Double-click the title bar to redock it. Any number of images may be open at the same time. Eachadditional image appears as a tab at the top of the image editor.

The Image Tab

Use the Image tab of the image editor to perform the following tasks:

• Rename the image using the Name text box.

• Browse for an image using the Browse button.

Reverse Engineering

With MySQL Workbench, you can reverse engineer a database using a MySQL create script or you canconnect to a live MySQL server and import a single database or a number of databases. All versions ofMySQL Workbench can reverse engineer using a MySQL DDL script. Only commercial versions of MySQLWorkbench can reverse engineer a database directly from a MySQL server.

Reverse Engineering Using a Create Script

To reverse engineer using a create script, choose the File, Import, Reverse Engineer MySQL CreateScript... menu items. This opens a file open dialog box with the default file type set to an SQL script file, afile with the extension sql.

You can create a data definition (DDL) script by executing the mysqldump db_name --no-data >script_file.sql command. Using the --no-data option ensures that the script contains only DDLstatements. However, if you are working with a script that also contains DML statements you need notremove them; they will be ignored.

Note

If you plan to redesign a database within MySQL Workbench and then exportthe changes, be sure to retain a copy of the original DDL script. You will needthe original script to create an ALTER script. For more information, see Altering aSchema.

Use the --databases option with mysqldump if you wish to create the database as well as all its objects.If there is no CREATE DATABASE db_name statement in your script file, you must import the databaseobjects into an existing schema or, if there is no schema, a new unnamed schema is created.

If your script creates a database, MySQL Workbench creates a new physical schemata tab on the MySQLModel page.

Any database objects may be imported from a script file in this fashion: tables, views, routines, and routinegroups. Any indexes, keys, and constraints are also imported. Objects imported using an SQL script canbe manipulated within MySQL Workbench the same as other objects.

Page 123: MySQL Workbench

Reverse Engineering

115

Before exiting, be sure to save the schema. Choose the File, Save menu item and the reverse-engineereddatabase will be saved as a MySQL Workbench file with the extension mwb.

See Importing a Data Definition SQL Script, for a tutorial on reverse engineering the sakila database.

Reverse Engineering a Live Database

To reverse engineer a live database, choose the Database, Reverse Engineer... menu item from the mainmenu. This opens the Reverse Engineer Database wizard.

Figure 7.18. Reverse Engineer Database Wizard

The first page of the wizard enables you to set up a connection to the live database you wish to reverseengineer. You can set up a new connection or select a previously created stored connection. Typicalinformation required for the connection includes host name, user name and password.

After this information has been entered, or you have selected a stored connection, click the Next button toproceed to the next page.

Page 124: MySQL Workbench

Reverse Engineering

116

Figure 7.19. Connect to DBMS

Review the displayed information to make sure that the connection did not generate errors, then click Next.

The next page displays the schemata available on the server. Click the check box or check boxes for anyschemata you wish to process.

Page 125: MySQL Workbench

Reverse Engineering

117

Figure 7.20. Select Schemata

After you have selected the desired schemata, click the Next button to continue.

The wizard then displays the tasks it carried out and summarizes the results of the operation.

Page 126: MySQL Workbench

Reverse Engineering

118

Figure 7.21. Retrieve Object Information

Review the results before clicking Next to continue.

The next page is the Select Objects page. It has a section for each object type present in the schema(tables, views, routines, and so forth). This page is of special interest if you do not wish to import all theobjects from the existing database. It gives you the option of filtering which objects are imported. Eachsection has a Show Filter button. Click this button if you do not want to import all the objects of a specifictype.

Page 127: MySQL Workbench

Reverse Engineering

119

Figure 7.22. Select Objects

For the Import MySQL Table Objects section, if you click the Show Filter button, the following page isdisplayed.

Page 128: MySQL Workbench

Reverse Engineering

120

Figure 7.23. Show Filter

This page enables you to select specific tables for import. Having selected the desired tables, you canoptionally hide the filter by clicking the Hide Filter button.

The other sections, such as MySQL Routine Objects, have similar filters available.

Click Execute to continue to the next page.

The wizard then imports objects, displaying the tasks that have been carried out and whether the operationwas successful. If errors were generated, you can click the Show Logs button to see the nature of theerrors.

Page 129: MySQL Workbench

Reverse Engineering

121

Figure 7.24. Progress

Click Next to continue to the next page.

The final page of the wizard provides a summary of the reverse engineered objects.

Page 130: MySQL Workbench

Reverse Engineering

122

Figure 7.25. Results

Click Finish to exit the wizard.

Before exiting MySQL Workbench be sure to save the schema. Choose the File, Save menu item to savethe reverse-engineered database as a MySQL Workbench file with the extension mwb.

Errors During Reverse Engineering

During reverse engineering, the application checks for tables and views that duplicate existing namesand disallows duplicate names if necessary. If you attempt to import an object that duplicates the nameof an existing object you will be notified with an error message. To see any errors that have occurredduring reverse engineering, you can click the button Show Logs. This will create a panel containing a listof messages, including any error messages than may have been generated. Click the Hide Logs button toclose the panel.

Page 131: MySQL Workbench

Forward Engineering

123

Figure 7.26. Message Log

If you wish to import an object with the same name as an existing object, rename the existing object beforereverse engineering.

If you import objects from more than one schema, there will be a tab in the Physical Schemata sectionof the MySQL Model page for each schema imported.

You cannot reverse engineer a live database that has the same name as an existing schema. If you wishto do this, first rename the existing schema.

Forward Engineering

It is possible to forward engineer a database using an SQL script or by connecting to a live database.

Page 132: MySQL Workbench

Forward Engineering

124

Forward Engineering Using an SQL Script

To create a script of your database model, choose the Export item from the File menu. You may export ascript to alter an existing database or create a new database. The script to create a database is similar tothe one created using the mysqldump db_name command.

If you choose to create a database, there are several export options available.

Creating a Schema

Select the File, Export, Forward Engineer SQL CREATE Script menu item to start the Forward EngineerSQL Script wizard. The following figure shows the first page of the wizard.

Figure 7.27. SQL Export Options

The SQL Export Options displays the following facilities:

• Output SQL Script File

Page 133: MySQL Workbench

Forward Engineering

125

To specify the output file name, enter it into the Output SQL Script File field, or use the Browse buttonto select a file. If this field is left blank, you will be able to view the generated script, but it will not besaved to a file.

• Generate DROP Statements Before Each CREATE Statement

Select this option to generate a statement to drop each object before the statement that creates it. Thisensures that any existing instance of each object is removed when the output is executed.

• Omit Schema Qualifier in Object Names

Select this option to generate unqualified object names in SQL statements.

• Generate Separate CREATE INDEX Statements

Select this option to create separate statements for index creation instead of including index definitionsin CREATE TABLE statements.

• Add SHOW WARNINGS after every DDL statement

Select this option to add SHOW WARNINGS statements to the output. This causes display of any warningsgenerated when the output is executed, which may be useful for debugging.

• Do Not Create Users. Only Export Privileges

Select this option to update the privileges of existing users, as opposed to creating new users. Exportingprivileges for nonexistent users will result in errors when you execute the CREATE script. Exporting usersthat already exist will also result in an error.

• Generate INSERT Statements for Tables

Select this option if you have added any rows to a table. For more information about inserting rows, seeThe Inserts Tab.

Clicking Next takes you to the SQL Object Export Filter page where you select the objects you wish toexport.

Page 134: MySQL Workbench

Forward Engineering

126

Figure 7.28. SQL Object Export Filter

Precise control over the objects to export can be fine tuned by clicking the Show Filter button. After theobjects to export have been selected, it is possible to reduce the expanded panel by clicking the samebutton, now labeled Hide Filter.

After selecting the objects to export, click the Next button to review the script that has been generated.

Page 135: MySQL Workbench

Forward Engineering

127

Figure 7.29. Review Generated Script

You may return to the previous page using the Back button.

The Finish button saves the script file and exits. You can then use the saved script to create a database.

Altering a Schema

The menu item for altering a schema, Forward Engineer SQL ALTER Script..., is used for updating adatabase that has been redesigned within MySQL Workbench. Typically, this option is used when the SQLscript of a database has been imported into MySQL Workbench and changed, and then you want to createa script that can be run against the database to alter it to reflect the adjusted model. For instructions onimporting a DDL script, see Reverse Engineering Using a Create Script.

Select the File, Export, Forward Engineer SQL ALTER Script menu item to start the Forward Engineer anALTER Script wizard. You will be presented with the first page showing the available options.

Page 136: MySQL Workbench

Forward Engineering

128

Figure 7.30. Options

This first page enables you to select an SQL script and compare it with the model currently in MySQLWorkbench. The difference between the two models will be used to create an alter script that can be usedto modify the target schema to match the model held in MySQL Workbench. To view the script generated,rather than saving it to a file, leave the Output File field empty.

Note

The script selected as the Input File must use full schema qualifiers, such asschema_name.table_name. Otherwise, MySQL Workbench cannot generate auseable alter script.

Clicking Next brings you to the Review SQL Script page.

Page 137: MySQL Workbench

Forward Engineering

129

Figure 7.31. Script

Here you can review and change the alter script that will be generated. Make any changes you wish and, ifyou are happy with the changes, save the ALTER script to file using the Save to File... button. You can alsoclick the Execute button to tell MySQL Workbench to write the script to the previously specified output file.

The generated script can then be used to update the database.

Forward Engineering to a Live Server

Use forward engineering to export your schema design to a MySQL server.

Select the schema that you wish to forward engineer and then choose the Database, Forward Engineer...menu item from the main menu.

The first page to be displayed is Catalog Validation (validation is available only in the Standard Edition).

Page 138: MySQL Workbench

Forward Engineering

130

Figure 7.32. Catalog Validation

Click Run Validations to validate the catalog.

Click Next to continue.

The next page enables you to set options for the database to be created. These options are as describedin Creating a Schema.

Page 139: MySQL Workbench

Forward Engineering

131

Figure 7.33. Options

Select the required options and then click Next.

The next page enables you to select the objects to forward engineer.

Page 140: MySQL Workbench

Forward Engineering

132

Figure 7.34. Select Objects to Forward Engineer

To select a subset of objects to forward engineer, use the Show Filter/Hide Filter button, then selectspecific objects. After you have selected your objects, click Next to continue

On the Review Script page you may review and edit the SQL script that will be executed.

Page 141: MySQL Workbench

Forward Engineering

133

Figure 7.35. Review Script

Click Next to continue if you are satisfied with the generated script.

The next step of the process is to connect to a MySQL server in order to create the new database schema.This page enables you to use a previously stored connection, or enter the connection parameters.

Page 142: MySQL Workbench

Forward Engineering

134

Figure 7.36. Set Parameters for Connecting to a DBMS

After the connection parameters have been set, click Execute. The next page of the wizard displays theresults of the forward engineering process.

Page 143: MySQL Workbench

Forward Engineering

135

Figure 7.37. Forward Engineering Progress

You can confirm that the script created the schema by connecting to the target MySQL server and issuinga SHOW DATABASES statement.

Database Synchronization

It is possible to synchronize a model in MySQL Workbench with a live database. By default, thesynchronization process will change the live database to be the same as the model, but this is configurableduring the synchronization process.

MySQL Workbench enables control over the direction of synchronization, and which objects tosynchronize, in a completely flexible way. You can choose to synchronize only certain tables, enablesynchronization to the live database only, enable synchronization from the live database to the modelonly, or a combination of directions. In effect you have complete control as to whether the synchronizationis unidirectional or bidirectional, and which objects exactly are subject to synchronization. This is allcontrolled in the Select Changes to Apply page of the synchronization wizard.

Page 144: MySQL Workbench

Forward Engineering

136

Figure 7.38. Model and Database Differences

In the preceding example, the live database consists of table1, table2 and table3. In MySQLWorkbench an additional table, table4, has been created, along with a relationship between it andtable3. Further, table5 exists in the live database, but not in the model. The actions that are configuredto occur would result in table3 being altered (to include the relationship with table4), table4 beingcreated and table5 being dropped, in the live database. It is possible to reconfigure this, though.

The next example shows how the direction of synchronization can be changed.

Page 145: MySQL Workbench

Forward Engineering

137

Figure 7.39. Controlling Synchronization Direction

In this case, the synchronization direction has been changed so that rather than the default action oftable5 being dropped from the live database, it will be incorporated into the MySQL Workbench model.

For convenience, the wizard provides three additional buttons to enable synchronization directions to beapplied to a group of selected changes. The Update Model button causes the selected changes to beapplied only to the model itself. In the following example, table7 would be added to the model.

Page 146: MySQL Workbench

Forward Engineering

138

Figure 7.40. Update Model Button

The Ignore button causes the selected changes to be ignored. No synchronization will take place for thosechanges. In the following example, no changes would take place.

Page 147: MySQL Workbench

Forward Engineering

139

Figure 7.41. Ignore Button

The Update Source button causes the selected changes to be applied only to the live database. In thefollowing example, table6 would be added to the live database and table7 would be dropped from thelive database.

Page 148: MySQL Workbench

Forward Engineering

140

Figure 7.42. Update Source Button

It is also possible to control individual changes by clicking the arrows. Clicking an arrow causes it tochange between the three available synchronization directions: from model to source, from source tomodel, or bidirectionally. In the following example, table6 will be created in the live database, andtable7 will be created in the model.

Page 149: MySQL Workbench

Forward Engineering

141

Figure 7.43. Click Arrows to Change Direction of Synchronization

Creating a Catalog Diff Report

This facility enables you to create a report detailing the differences between your MySQL Workbenchmodel, and a live database or script. Choose Database, Generate Catalog Diff Report from the main menuto run the Compare and Report Differences in Catalogs wizard.

The first step in the wizard is to specify which catalogs to compare. For example, you may wish to compareyour live database against your current MySQL Workbench model.

Page 150: MySQL Workbench

Forward Engineering

142

Figure 7.44. Catalog Sources

You then proceed through the wizard, providing connection information if accessing a live database. Thewizard then produces a catalog diff report showing the differences between the compared catalogs.

Page 151: MySQL Workbench

Modeling Tutorials

143

Figure 7.45. Catalog Diff Report

Modeling Tutorials

This chapter contains three short tutorials intended to familiarize you with the basics of MySQLWorkbench. These tutorials show how MySQL Workbench can be used both to design and to documentdatabases.

Creating a database from scratch is the focus of Using the Default Schema and exploring the graphicdesign capabilities of MySQL Workbench is touched upon in Basic Modeling. Both these tutorials show thedatabase design capabilities of MySQL Workbench.

Importing an SQL data definition script is probably the quickest way to familiarize yourself with MySQLWorkbench—this tutorial makes use of the sakila database and emphasizes the use of MySQLWorkbench as a documentation tool. Examples taken from the sakila database are used throughout thedocumentation, so doing this tutorial can be very helpful in understanding MySQL Workbench.

Page 152: MySQL Workbench

Importing a Data Definition SQL Script

144

Importing a Data Definition SQL Script

For this tutorial, use the sakila database script, which you can find by visiting the http://dev.mysql.com/doc/ page, selecting the Other Docs tab, and looking in the Example Databases section

After downloading the file, extract it to a convenient location. Open MySQL Workbench and find theReverse Engineer MySQL Create Script menu item by first choosing File and then Import. Find andimport the sakila-schema.sql file. This is the script that contains the data definition statements for thesakila database. The file filter for the file open dialog window defaults to *.sql so you should be able toview only files with the sql extension.

If the file was successfully imported, the application's status bar reads, Import MySQL Create Scriptdone. To view the newly imported script, expand the Physical Schemata section by double-clicking thearrow on the left of the Physical Schemata title bar. Select the tab labeled sakila.

You may also wish to remove the default schema tab, mydb. Select this tab, then click the - button on theupper right in the Physical Schemata panel.

To view all the objects in the sakila schema, you may need to expand the Physical Schemata window.Move the mouse pointer anywhere over the gray area that defines the lower edge of the PhysicalSchemata window. Hold down the right mouse button and move the mouse to adjust the size of thewindow.

After you have expanded the window, all the objects in the sakila database should be visible. Tablesappear at the top followed by views and then routines. There are no routine groups in this schema, but youshould see the Routine Groups section and an Add Group icon.

For a complete description of importing a MySQL create script, see Reverse Engineering Using a CreateScript.

Adding an EER Diagram

To create an EER diagram for the sakila database, first add an EER diagram by double-clicking the AddDiagram icon in the EER Diagrams panel to create and open a new EER Diagram editor.

The EER Diagram canvas is where object modeling takes place. To add a table to the canvas, select theCatalog tab in the middle panel on the right side of the application to display any schemata that appearin the MySQL Model tab. Find the sakila schema and expand the view of its objects by clicking the +button to the left of the schema name. Expand the tables list in the same way.

You can add tables to the EER canvas by dragging them from the Catalog panel dropping them onto thecanvas. Drop the address table and the city table onto the canvas.

Page 153: MySQL Workbench

Using the Default Schema

145

Figure 7.46. Adding Tables to the Canvas

MySQL Workbench automatically discovers that address.city_id has been defined as a foreign keyreferencing the city.city_id field. Drop the country table onto the canvas and immediately youshould see the relationship between the country table and the city table. (To view all the relationshipsin the sakila database, see Figure 7.49, “The sakila Database EER Diagram”.)

Click the Properties tab of the panel on the lower right, then click one of the tables on the canvas. Thisdisplays the properties of the table in the Properties window. While a table is selected, you can use theProperties window to change a table's properties. For example, entering #FF0000 for the color valuewill change the color accent to red.

Changing the color of a table is a good way to identify a table quickly—something that becomes moreimportant as the number of tables increases. Changing the color of a table is also an easy way to identify atable in the Model Navigator panel. This panel, the uppermost panel on the left side of the page, givesa bird's eye view of the entire EER canvas.

Save your changes to a MySQL Workbench Models file (mwb extension) by choosing Save from the Filemenu or by using the keyboard command Control+S.

Using the Default Schema

When you first open MySQL Workbench a default schema, mydb appears as the leftmost tab of thePhysical Schemata section of MySQL Workbench. You can begin designing a database by using thisdefault schema.

Page 154: MySQL Workbench

Using the Default Schema

146

Figure 7.47. The Default Schema

To change the name of the default schema, double-click the schema tab. This opens a schema editorwindow docked at the bottom of the application. To undock or redock this window, double-click anywherein the editor title bar.

To rename the schema, use the field labeled Name. After you have renamed the schema, a lightningbolt icon appears right aligned in the Name field, indicating that other changes are pending. Click theComments field and a dialog box opens asking if you wish to rename all schema occurrences. ClickingYes ensures that your changes are propagated throughout the application. Add comments to the databaseand change the collation if you wish. Close the schema editor by clicking the x button.

Creating a New Table

Create a new table by double-clicking the Add Table icon in the Physical Schemata panel. This opensthe table editor docked at the bottom of the application. If you wish, you can undock or dock this editor inexactly the same way as the schema editor window.

Use the first tab of the table editor to change the name, collation, and engine. You may also add acomment.

Page 155: MySQL Workbench

Basic Modeling

147

Add columns to the new table by selecting the Columns tab. Use the default column name or enter a newname of your choosing. Use the Tab key to move to the next column and set the column's data type.

Altering the table by adding indexes or other features is also easily done using the table editor.

Creating Other Schema Objects

Additional objects such as views or routines can be added in the same way as tables.

Any objects you have created can be found in the Catalog palette on the right. To view these schemaobjects, select the Catalog tab in the middle palette on the right. View all the objects by clicking the +button to the left of the schema name.

Save your changes to a MySQL Workbench Models file (mwb extension) by choosing Save from the Filemenu or by using the keyboard command Control+S.

Basic Modeling

On the MySQL Model page, double-click the Add Diagram icon. This creates and opens a new EERDiagram canvas.

Page 156: MySQL Workbench

Basic Modeling

148

Figure 7.48. Adding an EER Diagram

From an EER diagram page you can graphically design a database.

Adding a Table

The tools in the vertical toolbar on the left of the EER Diagram tab are used for designing an EERdiagram. Start by creating a table using the table tool. The table tool is the rectangular grid in the middle ofthe vertical toolbar. Mousing over it shows the message, Place a New Table (T).

Clicking this tool changes the mouse pointer to a hand with a rectangular grid. Create a table on thecanvas by clicking anywhere on the EER Diagram grid.

Right-click the table and choose Edit in New Window from the pop-up menu. This opens the table editor,docked at the bottom of the application.

Page 157: MySQL Workbench

Documenting the sakila Database

149

The table name defaults to table1. Change the name by entering invoice into the Name: field.Changes here affect the name of the tab in the table editor and the name of the table on the canvas.

Pressing Tab or Enter while the cursor is in the table name field selects the Columns tab of the tableeditor and creates a default column named idinvoice.

Pressing Tab or Enter again sets the focus on the Datatype list with INT selected. Notice that a field hasbeen added to the table on the EER canvas.

Pressing Tab yet again and the focus shifts to adding a second column. Add a Description and aCustomer_id column. When you are finished, close the table editor, by clicking the x button on the top leftof the table editor.

Creating a Foreign Key

Select the table tool again and place another table on the canvas. Name this table invoice_item. Nextclick the 1:n Non-Identifying Relationship tool.

First, click the invoice_item table; notice that a red border indicates that this table is selected. Next,click the invoice table. This creates a foreign key in the invoice_item table, the table on the “many”side of the relationship. This relationship between the two tables is shown graphically in crow's footnotation.

Revert to the default mouse pointer by clicking the arrow at the top of the vertical toolbar. Click on theinvoice_item table and select the Foreign keys tab.

Click the Foreign key Name field. The referenced table should show in the Referenced Table column andthe appropriate column in the Referenced Column column.

To delete the relationship between two tables, click the line joining the tables and then press Control+Delete.

Experiment with the other tools on the vertical toolbar. Delete a relationship by selecting the eraser tooland clicking the line joining two tables. Create a view, add a text object, or add a layer.

Save your changes to a MySQL Workbench Models file (mwb extension) by choosing Save from the Filemenu or by using the keyboard command Control+S.

Documenting the sakila Database

This chapter highlights the capabilities of MySQL Workbench as a documentation tool using the sakiladatabase as an example. This is a sample database provided by MySQL that you can find by visiting thehttp://dev.mysql.com/doc/ page, selecting the Other Docs tab, and looking in the Example Databasessection

An EER diagram is an invaluable aid to a quick understanding of any database. There is no need to readthrough table definition statements; glancing at an EER diagram can immediately indicate that varioustables are related.

You can also see how tables are related; what the foreign keys are and what the nature of the relationshipis.

A PNG File of the sakila Database

Find following an EER digram showing all the tables in the sakila database. This image was createdusing the File, Export, Export as PNG... menu item.

Page 158: MySQL Workbench

Documenting the sakila Database

150

Figure 7.49. The sakila Database EER Diagram

The object notation style used in Figure 7.49, “The sakila Database EER Diagram” is Workbench (PKsonly). This notation shows only primary keys and no other columns, which is especially useful wherespace is at a premium. The relationship notation is the default, Crow's Foot.

As the connection lines show, each table is related to at least one other table in the database (withthe exception of the film_text table). Some tables have two foreign keys that relate to the sametable. For example the film table has two foreign keys that relate to the language table, namelyfk_film_language_original and fk_film_language. Where more than one relationship existsbetween two tables, the connection lines run concurrently.

Identifying and nonidentifying relationships are indicated by solid and broken lines respectively. Forexample, the foreign key category_id is part of the primary key in the film_category table so itsrelationship to the category table is drawn with a solid line. On the other hand, in the city table, theforeign key, country_id, is not part of the primary key so the connection uses a broken line.

Page 159: MySQL Workbench

Printing

151

Printing

The printing options used to create printouts of your EER Diagrams are found under the File menu. Tocreate documentation of your models, see The DBDoc Model Reporting Dialog Window (CommercialVersion).

Printing Options

The printing menu items not enabled unless an EER Diagram is active. These items are available:

• Page Setup...

Enables you to choose the paper size, orientation, and margins.

• Print

Sends your EER Diagram directly to the printer. This option generates a preview before printing. Fromthe preview you can adjust the scale of the view and also choose a multi-page view. Clicking the printericon at the top left of this window, prints the currently selected EER Diagram. Close the print previewwindow if you need to adjust the placement of objects on the EER Diagram canvas.

• Print to PDF...

Creates a PDF file of your EER Diagram.

• Print to PS...

Creates a PostScript file of your EER Diagram.

MySQL Workbench Schema Validation Plugins (CommercialVersion)

MySQL Workbench provides validation modules so that you can test your models before implementingthem.

The validation plugins are accessed from the Model menu. One plugin performs general validation for anyRelational Database Management System (RDMS) and the other is MySQL specific. Beneath these menuitems are a number of specific validation tests. Running any one of these tests opens an output windowdocked at the bottom of the application. Warning messages are displayed on the left side of this windowand the tests performed are displayed on the right.

The following sections outline the tasks performed by the validation modules.

General Validation

The following list names the general validation types and gives examples of specific violations:

• Empty Content Validation

• A table with no columns

• A routine or view with no SQL code defined

• A routine group containing no routines

Page 160: MySQL Workbench

MySQL-Specific Validation

152

• A table, view, or routine not referenced by at least one role

• A user with no privileges

• Objects such as tables that do not appear on at least one EER Diagram

• Table Efficiency Validation

• A table with no primary key

• A primary key that does not use an integer-based data type

• A foreign key that refers to a column with a different data type

• Duplicated Identifiers Validation

• Duplicate object names

• Duplicate role or user names

• Duplicate index or routine names

• Consistency Validation

• Use of the same column with columns of differing data types

• Logic Validation

• A foreign key that refers to a column other than the primary key in the source table

• Any object that is object is either read only or write only by role definition

• Placeholder objects left over from reverse engineering

MySQL-Specific Validation

The following list names the MySQL-specific validation types and gives examples of specific violations:

• Integrity Violation

• An object name longer than the maximum permitted

• A foreign key defined for an engine type that does not support foreign keys (not yet implemented)

• A view or routine that references a nonexistent table (not yet implemented)

• A default value that does not match a column's data type

• An invalid partitioning scheme

• Syntax Violation

• A routine, trigger, or view with incorrect SQL syntax

• A reserved keyword used as an identifier

• Use of an invalid character

Page 161: MySQL Workbench

The DBDoc Model Reporting Dialog Window (Commercial Version)

153

The DBDoc Model Reporting Dialog Window (Commercial Version)

This dialog window is found by navigating to the Model menu and choosing the DBDoc - Model Reporting...item.

Note

The DBDoc - Model Reporting... item is not available in the MySQL WorkbenchOSS version.

Use this dialog window to set the options for creating documentation of your database models.

Page 162: MySQL Workbench

The DBDoc Model Reporting Dialog Window (Commercial Version)

154

Figure 7.50. The DBDoc Model Reporting Main Wizard

You can choose from four available templates:

• HTML Basic Frames: Model documentation in HTML format that makes use of frames

• HTML Basic Single Page: Single Page HTML documentation, not using frames

• HTML Detailed Frames: Detailed HTML documentation, using frames

Page 163: MySQL Workbench

The DBDoc Model Reporting Dialog Window (Commercial Version)

155

• Text Basic: Text file documentation

When you click a template, a preview image displays on the right side of the page. For the HTML BasicFrames template, you can select either the Colorful or the Restrained Colors option from the Stylelist. The HTML Basic Single Page template offers only the Colorful style. The HTML DetailedFrames template offers the Vibrant style, and also the more subdued Coated style. The Text Basictemplate offers only the Fixed Size Font style.

From the Base Options frame choose the report title and the output directory for the report files.

As of MySQL Workbench 5.1.17, it is possible to specify variables in the output path:

• ~: The user's home directory. Available on Linux and Mac OS X versions only.

• %desktopfolder%: The user's desktop.

• %documentsfolder%: The user's Documents folders. The following table shows typical values forvarious platforms.

Platform Typical Default Documents Folder

Windows C:\Documents and Settings\user_name\My Documents

Linux ~/Documents

Mac OS X Users/user_name/Documents

• %date%: The date in the format YYYY-MM-DD.

• %time%: The time in the format HHMM.

• %year%: The year in the format YYYY.

• %month%: The month in the format MM. January is 01 and December is 12.

• %monthname%: The name of the month, rather than the number.

• %day%: The day number in the format DD. For example, the 12th would be 12.

Content options can also be set:

• Render Table Columns: Display all the columns.

• Render Table Indices: Display all the indexes.

• Render Foreign Keys: Display all the foreign keys.

• List Foreign Keys that refer to that table: Display the tables that foreign keys reference.

• Include DDL code for objects: Generates DDL code.

Clicking the Generate button creates the directory defined in the Output directory text box. If you chose tocreate HTML Basic Frames, you will find the following files in this directory:

• basic.css: The style sheet for the overview.html page.

• index.html: The main page.

• overview.html: The model overview, the navigation links shown in the sidebar.

Page 164: MySQL Workbench

The DBDoc Model Reporting Dialog Window (Commercial Version)

156

• restrained.css: The CSS file used if the Restrained Colors style option was chosen.

• table_details.html: The main frame of the model report.

Choosing the HTML Basic Single Page option creates a style sheet and an index.html file.

Choosing the HTML Detailed Frames option creates the following files:

• basic.css: The style sheet for the overview.html page. This is used if the vibrant style is chosen.

• coated.css: The CSS file used if the Coated style option was chosen.

• index.html: The main page.

• overview.html: Overview information for the report such as report title, project name and author.

• overview_list.html: A summary of schema in the model along with a list of tables contained in eachschema.

• routine_details.html: List of all routines for the schema.

• table_details.html: The main report details.

• table_details_list.html: A Schema overview along with details of columns, indexes and foreignkeys for each schema.

• table_element_details.html: The details for every element of the table.

• top.html: The top frame of the report.

• view_details.html: List of all columns and indexes for the schema.

Choosing the Text Basic option creates a directory containing one text file.

You can click index.html to view a report. The following screenshot shows the HTML DetailedFrames report being displayed:

Page 165: MySQL Workbench

Customizing DBDoc Model Reporting Templates

157

Figure 7.51. The DBDoc Model Report

If you wish to create custom templates please refer to Customizing DBDoc Model Reporting Templates.

Customizing DBDoc Model Reporting Templates

This section provides an overview of creating and modifying DBDoc Model Reporting templates, as usedby MySQL Workbench.

The MySQL Workbench DBDoc Model Reporting system is based on the Google Template System. Thisdiscussion does not attempt to explain the Google Template System in detail. For a useful overview ofhow the Google Template System works, see the Google document, How To Use the Google TemplateSystem.

The templates employed by the DBDoc Model Reporting system are text files that contain Markers. Thesetext files are processed by the template system built into MySQL Workbench, and the markers replaced byactual data. The output files are then generated. It is these output files, typically HTML or text, that are thenviewed by the user.

Markers can be of six types:

• Template Include

• Comment

Page 166: MySQL Workbench

Customizing DBDoc Model Reporting Templates

158

• Set delimiter

• Pragma

• Variable

• Section start and Section end

The last two are the most commonly used in MySQL Workbench templates and these important markersare briefly described in the following sections.

• Variables

The use of variables in the templates is straightforward. Any variables denoted by markers in thetemplate file are replaced by their corresponding data prior to the output file being generated. Themapping between variables and their corresponding data is stored by MySQL Workbench in whatis known as a data dictionary. In the data dictionary, the variable name is the key and the variable'scorresponding data is the value. The data dictionaries are built by MySQL Workbench and filled with thedata contained in the model being processed.

By way of example, the following code snippet shows part of a template file:

Total number of Schemata: {{SCHEMA_COUNT}}

In the generated output file, the variable {{SCHEMA_COUNT}} is replaced by the number of schemata inthe model:

Total number of Schemata: 2

A variable can appear as many times as required in the template file.

• Sections

Sections are used to perform iteration in the templates. When MySQL Workbench exchanges thevariables in a section for data, it does so iteratively, using all data in the data dictionary in which thevariable is defined. MySQL Workbench builds the data dictionaries according to the model currentlybeing processed.

Consider the following code snippet:

{{#SCHEMATA}}Schema: {{SCHEMA_NAME}}{{/SCHEMATA}}

In the preceding snippet, the section start and end are indicated by the {{#SCHEMATA}} and {{/SCHEMATA}} markers. When MySQL Workbench processes the template, it notes the section anditerates it until the variable data for {{SCHEMA_NAME}} in the corresponding data dictionary isexhausted. For example, if the model being processed contains two schemata, the output for the sectionmight resemble the following:

Schema: AirlinesSchema: Airports

Data Dictionaries

It is important to understand the relationship between sections and data dictionaries in more detail. In adata dictionary the key for a variable is the variable name, a marker. The variable value is the variable'sdata. The entry for a section in a data dictionary is different. For a section entry in a data dictionary, the keyis the section name, the marker. However, the value associated with the key is a list of data dictionaries. In

Page 167: MySQL Workbench

Customizing DBDoc Model Reporting Templates

159

MySQL Workbench each section is usually associated with a data dictionary. You can think of a section asactivating its associated dictionary (or dictionaries).

When a template is processed, data dictionaries are loaded in a hierarchical pattern, forming a tree of datadictionaries. This is illustrated by the following table.

Table 7.1. Data Dictionaries Tree

Data Dictionary Loads Data Dictionary

MAIN SCHEMATA

SCHEMATA TABLES, COLUMNS (Detailed is true), FOREIGN_KEYS(Detailed is true), INDICES (Detailed is true)

TABLES REL_LISTING, INDICES_LISTING, COLUMNS_LISTING,TABLE_COMMENT_LISTING, DDL_LISTING

COLUMNS_LISTING COLUMNS (Detailed is false)

REL_LISTING REL (Detailed is false)

INDICES_LISTING INDICES (Detailed is false)

The root of the tree is the main dictionary. Additional dictionaries are loaded from the root to form thedictionary tree.

Note

If a template has no sections, any variables used in the template are looked up inthe main dictionary. If a variable is not found in the main dictionary (which can bethought of as associated with the default, or main, section), no data is generated inthe output file for that marker.

Evaluation of variables

The tree structure of the data dictionaries is important with respect to variable evaluation. As variables aredefined in data dictionaries, their associated values have meaning only when that particular data dictionaryis active, and that means when the section associated with that data dictionary is active. When a variablelookup occurs, the system checks the data dictionary associated with the current section. If the variablevalue can be found there, the replacement is made. However, if the variable's value is not found in thecurrent data dictionary, the parent data dictionary is checked for the variable's value, and so on up the treeuntil the main data dictionary, or root, is reached.

Suppose that we want to display the names of all columns in a model. Consider the following template asan attempt to achieve this:

Report------Column Name: {{COLUMN_NAME}}

This template produces no output, even for a model that contains many columns. In this example, theonly data dictionary active is the main dictionary. However, COLUMN_NAME is stored in the COLUMNS datadictionary, which is associated with the COLUMNS section.

With this knowledge, the template can be improved as follows:

Report------{{#COLUMNS}}Column Name: {{COLUMN_NAME}}

Page 168: MySQL Workbench

Customizing DBDoc Model Reporting Templates

160

{{/COLUMNS}}

This still does not produce output. To see why, see Table 7.1, “Data Dictionaries Tree”. The COLUMNS datadictionary has the parent dictionary COLUMNS_LISTING. COLUMNS_LISTING has the parent TABLES,which has the parent SCHEMATA, whose parent is the main dictionary. Remember that for a dictionary to beinvolved in variable lookup, its associated section must currently be active.

To achieve the desired output, the template must be something like the following:

Report------

{{#SCHEMATA}}{{#TABLES}}{{#COLUMNS_LISTING}}{{#COLUMNS}}Column Name: {{COLUMN_NAME}}{{/COLUMNS}}{{/COLUMNS_LISTING}}{{/TABLES}}{{/SCHEMATA}}

The following template is the same, but with explanatory comments added:

Report------

{{! Main dictionary active}}{{#SCHEMATA}} {{! SCHEMATA dictionary active}}{{#TABLES}} {{! TABLES dictionary active}}{{#COLUMNS_LISTING}} {{! COLUMNS_LISTING dictionary active}}{{#COLUMNS}} {{! COLUMNS dictionary active}}Column Name: {{COLUMN_NAME}} {{! COLUMN_NAME variable is looked-up, and found, in COLUMNS data dictionary}}{{/COLUMNS}}{{/COLUMNS_LISTING}}{{/TABLES}}{{/SCHEMATA}}

Imagine now that for each column name displayed you also wanted to display its corresponding schemaname, the template would look like this:

Report------

{{#SCHEMATA}}{{#TABLES}}{{#COLUMNS_LISTING}}{{#COLUMNS}}Schema Name: {{SCHEMA_NAME}} Column Name: {{COLUMN_NAME}}{{/COLUMNS}}{{/COLUMNS_LISTING}}{{/TABLES}}{{/SCHEMATA}}

When variable lookup is performed for SCHEMA_NAME, the COLUMNS dictionary is checked. As the variableis not found there the parent dictionary will be checked, COLUMNS_LISTING, and so on, until the variableis eventually found where it is held, in the SCHEMATA dictionary.

If there are multiple schemata in the model, the outer section is iterated over a matching number of times,and SCHEMA_NAME accordingly has the correct value on each iteration.

It's important to always consider which dictionary must be active (and which parents) for a variable to beevaluated correctly. The following section has a table that helps you identify section requirements.

Page 169: MySQL Workbench

Supported Template Markers

161

Supported Template Markers

The following table shows the supported markers. These markers can be used in any template, includingcustom templates.

Marker text Type Data Dictionarydefined in (ifvariable) or parentdictionary (ifsection)

Corresponding data

TITLE Variable MAIN Title of the report

GENERATED Variable MAIN Date and time when the report wasgenerated

STYLE_NAME Variable MAIN The name of the style selected in MySQLWorkbench, this is typically used to loadthe corresponding CSS file, depending onthe name of the style selected in MySQLWorkbench

SCHEMA_COUNT Variable MAIN The number of schemata in the model

PROJECT_TITLE Variable MAIN Project title as set for the model inDocument Properties

PROJECT_NAME Variable MAIN Project name as set for the model inDocument Properties

PROJECT_AUTHORVariable MAIN Project author as set for the model inDocument Properties

PROJECT_VERSIONVariable MAIN Project version as set for the model inDocument Properties

PROJECT_DESCRIPTIONVariable MAIN Project description as set for the model inDocument Properties

PROJECT_CREATEDVariable MAIN Automatically set for the model project,but as displayed in Document Properties

PROJECT_CHANGEDVariable MAIN Automatically set for the model project,but as displayed in Document Properties

TOTAL_TABLE_COUNTVariable MAIN The number of tables in all schemata inthe model

TOTAL_COLUMN_COUNTVariable MAIN The number of columns in all tables in allschemata in the model

TOTAL_INDEX_COUNTVariable MAIN The number of indexes in the model

TOTAL_FK_COUNT Variable MAIN The number of foreign keys in the model

SCHEMATA Section MAIN Used to mark the start and end of aSCHEMATA section; the SCHEMATAdata dictionary becomes active in thissection

SCHEMA_NAME Variable SCHEMATA The schema name

SCHEMA_ID Variable SCHEMATA The schema ID

TABLE_COUNT Variable SCHEMATA The number of tables in the currentschema

Page 170: MySQL Workbench

Supported Template Markers

162

Marker text Type Data Dictionarydefined in (ifvariable) or parentdictionary (ifsection)

Corresponding data

COLUMN_COUNT Variable SCHEMATA The number of columns in the currentschema

INDICES_COUNT Variable SCHEMATA The number of indexes in the currentschema

FOREIGN_KEYS_COUNTVariable SCHEMATA The number of foreign keys in the currentschema

TABLES Section SCHEMATA Marks the start and end of a TABLESsection; the TABLES data dictionarybecomes active in this section

TABLE_NAME Variable TABLES The table name

TABLE_ID Variable TABLES The table ID

COLUMNS_LISTINGSection TABLES Marks the start and end of aCOLUMNS_LISTING section; theCOLUMNS_LISTING data dictionarybecomes active in this section

COLUMNS Section COLUMNS_LISTINGMarks the start and end of a COLUMNSsection; the COLUMNS data dictionarybecomes active in this section

COLUMN_KEY Variable COLUMNS Whether the column is a primary key

COLUMN_NAME Variable COLUMNS The column name

COLUMN_DATATYPEVariable COLUMNS The column data type

COLUMN_NOTNULLVariable COLUMNS Whether the column permits NULL values

COLUMN_DEFAULTVALUEVariable COLUMNS The column default value

COLUMN_COMMENTVariable COLUMNS The column comment

COLUMN_ID Variable COLUMNS The column ID

COLUMN_KEY_PARTVariable COLUMNS (ifdetailed)

The column key type

COLUMN_NULLABLEVariable COLUMNS (ifdetailed)

Can the column contain NULL values

COLUMN_AUTO_INCVariable COLUMNS (ifdetailed)

Does the column auto-increment

COLUMN_CHARSETVariable COLUMNS (ifdetailed)

The column character set

COLUMN_COLLATIONVariable COLUMNS (ifdetailed)

The column collation

COLUMN_IS_USERTYPEVariable COLUMNS (ifdetailed)

Whether the column is a user type

INDICES_LISTING Section TABLES Marks the start and end of anINDICES_LISTING section; the

Page 171: MySQL Workbench

Supported Template Markers

163

Marker text Type Data Dictionarydefined in (ifvariable) or parentdictionary (ifsection)

Corresponding data

INDICES_LISTING data dictionarybecomes active in this section

INDICES Section INDICES_LISTING Marks the start and end of an INDICESsection; the INDICES data dictionarybecomes active in this section

INDEX_NAME Variable INDICES The index name

INDEX_PRIMARY Variable INDICES Whether this is a primary key

INDEX_UNIQUE Variable INDICES Whether this is a unique index

INDEX_TYPE Variable INDICES The index type; for example, PRIMARY

INDEX_KIND Variable INDICES The index kind

INDEX_COMMENT Variable INDICES The index comment

INDEX_ID Variable INDICES The index ID

INDEX_COLUMNS Section INDICES Marks the start and end of anINDEX_COLUMNS section; theINDEX_COLUMNS data dictionarybecomes active in this section

INDEX_COLUMN_NAMEVariable INDEX_COLUMNS The index column name

INDEX_COLUMN_ORDERVariable INDEX_COLUMNS The index column order; for example,ascending, descending

INDEX_COLUMN_COMMENTVariable INDEX_COLUMNS The index comment

INDEX_KEY_BLOCK_SIZEVariable INDEX_COLUMNS(if detailed)

The index key-block size

REL_LISTING Section TABLES Marks the start and end of aREL_LISTING section; the REL_LISTINGdata dictionary becomes active in thissection

REL Section REL_LISTING Marks the start and end of a REL section;the REL data dictionary becomes activein this section

REL_NAME Variable REL,FOREIGN_KEYS

The relationship name

REL_TYPE Variable REL,FOREIGN_KEYS

The relationship type

REL_PARENTTABLEVariable REL,FOREIGN_KEYS

The relationship parent table

REL_CHILDTABLE Variable REL,FOREIGN_KEYS

The relationship child table

REL_CARD Variable REL,FOREIGN_KEYS

The relationship cardinality

FOREIGN_KEY_ID Variable REL Foreign key ID

Page 172: MySQL Workbench

Creating a Custom Template

164

Marker text Type Data Dictionarydefined in (ifvariable) or parentdictionary (ifsection)

Corresponding data

FOREIGN_KEYS Section SCHEMATA Marks the start and end of aFOREIGN_KEYS section; theFOREIGN_KEYS data dictionarybecomes active in this section

FK_DELETE_RULE Variable FOREIGN_KEYS The foreign key delete rule

FK_UPDATE_RULE Variable FOREIGN_KEYS The foreign key update rule

FK_MANDATORY Variable FOREIGN_KEYS Whether the foreign key is mandatory

TABLE_COMMENT_LISTINGSection TABLES Marks the start and end of aTABLE_COMMENT_LISTING section;the TABLE_COMMENT_LISTING datadictionary becomes active in this section

TABLE_COMMENT Variable TABLE_COMMENT_LISTINGThe table comment

DDL_LISTING Section TABLES Marks the start and end of aDDL_LISTING section; theDDL_LISTING data dictionary becomesactive in this section

DDL_SCRIPT Variable DDL_LISTING Display the DDL script of the currentlyactive entity; for example, SCHEMATA,TABLES

Using the table

The table shows which variables are defined in which sections. The variable should be used in its correctsection or its value will not be displayed. However, remember that the data dictionaries used to performvariable lookups form a hierarchical tree, so it is possible to use a variable in a child section that is definedin a parent section.

Creating a Custom Template

In the simplest case, a template consists of two files: a template file, which has a .tpl extension, anda special file info.xml. The info.xml file has important metadata about the template. A third file isoptional, which is the preview image file. This preview file provides a thumbnail image illustrating theappearance of the generated report.

One of the easiest ways to create a custom template is to make a copy of any existing template.

For example, the following procedure describes how to make a custom template based on the TextBasic template.

1. Navigate to the folder where the templates are stored. Assuming that MySQL Workbench has beeninstalled into the default location on Windows, this would be C:\Program Files\MySQL\MySQLWorkbench 5.0 SE\modules\data\wb_model_reporting.

2. Copy the Text_Basic.tpl folder. The copy can be given any suitable name; for example,Custom_Basic.tpl.

3. Edit the info.xml file to reflect your custom template. The unedited file in this case is shown here:

Page 173: MySQL Workbench

Creating a Custom Template

165

<?xml version="1.0"?><data> <value type="object" struct-name="workbench.model.reporting.TemplateInfo" id="{BD6879ED-814C-4CA3-A869-9864F83B88DF}" struct-checksum="0xb46b524d"> <value type="string" key="description">A basic TEXT report listing schemata and objects.</value> <value type="string" key="name">HTML Basic Frame Report</value> <value type="list" content-type="object" content-struct-name="workbench.model.reporting.TemplateStyleInfo" key="styles"> <value type="object" struct-name="workbench.model.reporting.TemplateStyleInfo" id="{7550655C-CD4B-4EB1-8FAB-AAEE49B2261E}" struct-checksum="0xab08451b"> <value type="string" key="description">Designed to be viewed with a fixed sized font.</value> <value type="string" key="name">Fixed Size Font</value> <value type="string" key="previewImageFileName">preview_basic.png</value> <value type="string" key="styleTagValue">fixed</value> </value> </value> <value type="string" key="mainFileName">report.txt</value> </value></data>

The file defines wwo objects: the TemplateInfo object and the TemplateStyleInfo object. Theseobjects contain information about the template that will be displayed in the DBDoc Model Reportingwizard main page.

4. Change the object GUIDs that are used in the file. In this example, there are two that need replacing:

id="{BD6879ED-814C-4CA3-A869-9864F83B88DF}"...id="{7550655C-CD4B-4EB1-8FAB-AAEE49B2261E}"

Generate two new GUIDS. This can be done using any suitable command-line tool. There are alsofree online tools that can be used to generate GUIDs. Another way to generate GUIDs is by using theMySQL UUID() function:

mysql> SELECT UUID();+--------------------------------------+| UUID() |+--------------------------------------+| 648f4240-7d7a-11e0-870b-89c43de3bd0a |+--------------------------------------+

Once you have the new GUID values, edit the info.xml file accordingly.

5. Edit the textual information for the TemplateInfo and TemplateStyleInfo objects to reflect thepurpose of the custom template.

6. The modified file will now look something like the following:

<?xml version="1.0"?><data> <value type="object" struct-name="workbench.model.reporting.TemplateInfo" id="{cac9ba3f-ee2a-49f0-b5f6-32580fab1640}" struct-checksum="0xb46b524d"> <value type="string" key="description">Custom basic TEXT report listing schemata and objects.</value> <value type="string" key="name">Custom Basic text report</value> <value type="list" content-type="object" content-struct-name="workbench.model.reporting.TemplateStyleInfo" key="styles"> <value type="object" struct-name="workbench.model.reporting.TemplateStyleInfo" id="{39e3b767-a832-4016-8753-b4cb93aa2dd6}" struct-checksum="0xab08451b"> <value type="string" key="description">Designed to be viewed with a fixed sized font.</value> <value type="string" key="name">Fixed Size Font</value> <value type="string" key="previewImageFileName">preview_basic.png</value>

Page 174: MySQL Workbench

Creating a Custom Template

166

<value type="string" key="styleTagValue">fixed</value> </value> </value> <value type="string" key="mainFileName">custom_report.txt</value> </value></data>

7. Create the new template file. This too may best be achieved, depending on your requirements, byediting an existing template. In this example the template file report.txt.tpl is shown here:

+--------------------------------------------+| MySQL Workbench Report |+--------------------------------------------+

Total number of Schemata: {{SCHEMA_COUNT}}============================================={{#SCHEMATA}}{{SCHEMA_NR}}. Schema: {{SCHEMA_NAME}}----------------------------------------------## Tables ({{TABLE_COUNT}}) ##{{#TABLES}}{{TABLE_NR_FMT}}. Table: {{TABLE_NAME}}{{#COLUMNS_LISTING}}## Columns ##Key Column Name Datatype Not Null Default Comment{{#COLUMNS}}{{COLUMN_KEY}}{{COLUMN_NAME}}{{COLUMN_DATATYPE}} »{{COLUMN_NOTNULL}}{{COLUMN_DEFAULTVALUE}}{{COLUMN_COMMENT}}{{/COLUMNS}}{{/COLUMNS_LISTING}}{{#INDICES_LISTING}}## Indices ##Index Name Columns Primary Unique Type Kind Comment{{#INDICES}}{{INDEX_NAME}}{{#INDICES_COLUMNS}}{{INDEX_COLUMN_NAME}} »{{INDEX_COLUMN_ORDER}}{{INDEX_COLUMN_COMMENT}}{{/INDICES_COLUMNS}} »{{INDEX_PRIMARY}}{{INDEX_UNIQUE}}{{INDEX_TYPE}}{{INDEX_KIND}}{{INDEX_COMMENT}}{{/INDICES}}{{/INDICES_LISTING}}{{#REL_LISTING}}## Relationships ##Relationship Name Relationship Type Parent Table Child Table Cardinality{{#REL}}{{REL_NAME}}{{REL_TYPE}}{{REL_PARENTTABLE}}{{REL_CHILDTABLE}}{{REL_CARD}}{{/REL}}{{/REL_LISTING}}---------------------------------------------

{{/TABLES}}{{/SCHEMATA}}=============================================End of MySQL Workbench Report

This template shows details for all schemata in the model.

8. The preceding template file can be edited in any way you like, with new markers being added, andexisting markers being removed as required. For the custom template example, you might want tocreate a much simpler template, such as the one following:

+--------------------------------------------+| MySQL Workbench Custom Report |+--------------------------------------------+

Total number of Schemata: {{SCHEMA_COUNT}}============================================={{#SCHEMATA}}Schema Name: {{SCHEMA_NAME}}----------------------------------------------## Tables ({{TABLE_COUNT}}) ##

{{#TABLES}}Table Name: {{TABLE_NAME}}{{/TABLES}}{{/SCHEMATA}}

Report Generated On: {{GENERATED}}

Page 175: MySQL Workbench

Creating a Custom Template

167

=============================================End of MySQL Workbench Custom Report

This simplified report just lists the schemata and the tables in a model. The date and time the reportwas generated is also displayed as a result of the use of the {{GENERATED}} variable.

9. The custom template can then be tested. Start MySQL Workbench, load the model to generate thereport for, select the Model, DBDOC - Model Reporting menu item. Then select the new customtemplate from the list of available templates, select an output directory, and click Finish to generate thereport. Finally, navigate to the output directory to view the finished report.

Page 176: MySQL Workbench

168

Page 177: MySQL Workbench

169

Chapter 8. Server Administration

Table of ContentsServer Administration ..................................................................................................................... 169New Server Instance ...................................................................................................................... 170Manage Data Import/Export ............................................................................................................ 170Manage Security ............................................................................................................................ 170Manage Server Instances ............................................................................................................... 170Creating and Managing Server Instances ........................................................................................ 170

New Server Instance Wizard .................................................................................................. 170Manage Server Instances Dialog ............................................................................................ 173

Server Administration and Configuration .......................................................................................... 175The Startup Tab .................................................................................................................... 177The Configuration Tab ............................................................................................................ 178The Accounts Tab .................................................................................................................. 179The Connections Tab ............................................................................................................. 181The Variables Tab ................................................................................................................. 182The Data Dump Tab .............................................................................................................. 183The Logs Tab ........................................................................................................................ 186

Since version 5.2.6, MySQL Workbench has included functionality for managing server instances. A serverinstance is created to provide a way of connecting to a server to be managed. The first step is to create aserver instance if none exists, or to work with an existing server instance.

MySQL Workbench also provides functionality to administer and configure a server using these serverinstances. Thus, the Server Administrator functionality can be broadly grouped into two main areas:

• Creating and managing server instances

• Administration and configuration functions using a server instance

The Workspace section of the Home window has an area for Server Administration tasks. This section ofthe Workspace has the following action items:

• Server Administration

• Server Administration (icon)

• New Server Instance

• Manage Data Import/Export

• Manage Security

• Manage Server Instances

The following sections describe each of these action items.

Server AdministrationThis action item enables you to quickly connect to a predefined server instance and carry outadministration functions on the associated server. Clicking this item launches the Server Administrationdialog, from which you can select the server instance to which you wish to connect. A new Admin tab willbe launched, which displays the Server Status and Configuration.

Page 178: MySQL Workbench

New Server Instance

170

Server Administration (icon)

If you have already created server instances, you can most quickly launch these by clicking the icon for theServer Instance you wish to access. A new Admin tab will be launched, which displays Server Status andConfiguration.

For further details, see Server Administration and Configuration.

New Server Instance

This action item enables you to create a new server instance. A server instance is primarily a combinationof connection and configuration details for a specific server that you wish to manage. When you click thisitem, a wizard is launched that enables you to specify the connection and various other configurationparameters. After completion of the wizard, a new Admin tab is launched, which displays Server Statusand Configuration.

For further details, see New Server Instance Wizard.

Manage Data Import/Export

This action item enables you to create a dump file from a database, or restore data from a file to a livedatabase. Clicking this item launches the Import/Export MySQL Data wizard. This enables you to select aserver instance to connect to.

For further details, see The Data Dump Tab.

Manage Security

This action item takes you quickly to the page that enables you to manage user accounts. It launches anAdmin page and locates you on the Accounts tab. For further details, see The Accounts Tab.

Manage Server Instances

Clicking this action item launches the Manage Server Instances dialog. Within this dialog, you can changethe configuration of existing server instances or create a new server instance. For further details, seeCreating and Managing Server Instances.

Creating and Managing Server Instances

Server instances can be created and managed from the Home page. To create new server instances, useone of these methods:

• Click the New Server Instance action item from the Server Administration section of the Home window.This launches the Create a new server instance wizard. For further details, see New Server InstanceWizard.

• Click the Manage Server Instances action item from the Server Administration section of the Homewindow. This launches the Manage Server Instances dialog, from within which a new server instancecan be created. For further details, see Manage Server Instances Dialog.

New Server Instance Wizard

Clicking the New Server Instance action item launches the Create a new server instance wizard. Thewizard provides a step-by-step approach to creating a new server instance. This is most suitable for

Page 179: MySQL Workbench

New Server Instance Wizard

171

beginners. Users who are familiar with the various settings and parameters can also quickly create a newinstance from the Manage Server Instances dialog discussed later.

The steps presented in the wizard are as follows:

1. Specify Host Machine

2. Database Connection

3. Test DB Connection

4. Management and OS

5. SSH Configuration

6. Windows Management

7. Test Settings

8. Review Settings

9. MySQL Config File

10. Specify Commands

11. Complete Setup

Specify host machine

On this page you can select Localhost if you intend to manage a server on your local machine. If youselect Remote Host, you must provide the IP address or the network name of the remote server. Or, TakeParameters from Existing Database Connection utilizes a pre-existing connection as defined withinMySQL Workbench. Click Next to continue.

Database Connection

This page enables you to select a connection to a specific database. The settings entered previouslyhave been concerned with the connection to the server required for administrative purposes. This pageis concerned with connecting to a specific database. You can either launch the Manage DB Connectionsdialog or select a pre-existing connection from a list. The former is most useful if you have not created anyconnections. If you must create a connection at this point, refer to Manage DB Connections Dialog. After aconnection has been selected, click Next to continue.

Test DB Connection

On this page, MySQL Workbench tests your database connection and displays the results. If an erroroccurs, you are directed to view the logs, which can be done by clicking the Show Logs button.

Management and OS

Used to specify a remote management type and target operating system, which is available when the HostMachine is defined as a remote host.

The SSH login based management option includes configuration entries for the Operating System andMySQL Installation Type.

SSH Configuration

Page 180: MySQL Workbench

New Server Instance Wizard

172

If you specified a Remote Host on the Specify Host Machine page, you will be presented with the HostSSH Connection page, that enables you to use SSH for the connection to the server instance. This facilityenables you to create a secure connection to remotely administer and configure the server instance.You must enter the host name and user name of the account that will be used to log in to the server foradministration and configuration activities. If you do not enter the optional SSH Key for use with the server,then you will be prompted for the password when the connection is established by MySQL Workbench.

Note

This connection is to enable remote administration and configuration of the MySQLServer itself. It is not the same as the connection used to connect to a server forgeneral database manipulation.

Note

You must use an SSH connection type when managing a remote server if you wishto start or stop the server or edit its configuration file. Other administrative functionsdo not require an SSH connection.

Windows Management

If a Windows server is used, then the Windows configuration parameters must be set. Windowsmanagement requires a user account with the required privileges to query the system status, and to controlservices. And read/write access to the configuration file is needed to allow editing of the file.

Test Settings

On the next page your settings are tested and the wizard reports back the results after attempting toconnect to the server. If an error occurs, you are directed to view the logs, which can be done by clickingthe Show Logs button.

MySQL Workbench must know where the MySQL Server configuration file is located to be able to displayconfiguration information. The wizard is able to determine the most likely location of the configuration file,based on the selection made on the Operating System page of the wizard. However, it is possible to testthat this information is correct by clicking the Check path and Check section buttons. The wizard thenreports whether the configuration file and server configuration section can in fact be accessed. It is alsopossible to manually enter the location of the configuration file, and the section pertaining to MySQL Serverdata; these manually entered values should be tested using the buttons provided. Click the Next button tocontinue.

Review Settings

The modified settings may be reviewed, which also includes the default values. Check the ChangeParameters checkbox if the MySQL Config File section will be edited, and then click Next to continue.

MySQL Config File

Allows configuration of the MySQL server version. It also allows the editing and validation of theconfiguration file path, and validation of the server instance section. Click Next to continue.

Specify Commands

This page enables you to set the commands required to start, stop, and check the status of the runningserver instance. It is possible to customize the commands if required, but the defaults should be suitablein most cases. The defaults are set based on the options selected in the Operating System page of thewizard. Click Next to continue.

Page 181: MySQL Workbench

Manage Server Instances Dialog

173

Complete Setup

On this page, you finally assign a name to the server instance. This name is used in various parts of theGUI to enable you to refer to this instance. After setting a suitable name, click Finish to save the instance.

Manage Server Instances Dialog

The Manage Server Instances dialog enables you to create, delete, and manage server instances. TheConnection tab of the wizard enables you to select a predefined connection to use for connecting to aserver to be managed. It is also possible to connect to a remote server using an SSH connection.

Figure 8.1. Manage Server Instances Dialog

Page 182: MySQL Workbench

Manage Server Instances Dialog

174

The System Profile tab of the wizard enables you to specify server-specific information. This is achievedprimarily through selecting a Profile Template. A Profile Template contains standard information used inmanaging the server instance. The following Profile Templates are available:

• Fedora Linux (MySQL Package)

• Fedora Linux (Vendor Package)

• FreeBSD (MySQL Package)

• Generic Linux (MySQL tar package)

• Mac OS X (MySQL Package)

• OpenSolaris (MySQL Package)

• RHEL (MySQL Package)

• SLES (MySQL Package)

• Ubuntu Linux (MySQL Package)

• Ubuntu Linux (Vendor Package)

• Windows (MySQL 5.0 Installer Package)

• Windows (MySQL 5.1 Installer Package)

• Windows (MySQL zip package)

• Custom

After you select a profile, a number of default parameters will be set, including commands used to start andstop MySQL, commands to check server status, and the location of the my.ini or my.cnf configurationfile.

Page 183: MySQL Workbench

Server Administration and Configuration

175

Figure 8.2. Manage Server Instances Dialog

After an instance has been created, it can be launched by double-clicking its icon in the ServerAdministration panel of the Home page. This creates an Admin page, which has two main panels, ServerStatus and Configuration. The Configuration panel features multiple tabs: Startup, Configuration,Accounts, Connections, Variables, Data Dump, and Logs.

Server Administration and Configuration

The Administrator functionality in MySQL Workbench is grouped into several tabs:

• Startup: Enables you to start and stop the MySQL server, and view the startup message log

Page 184: MySQL Workbench

Server Administration and Configuration

176

• Configuration: Enables you to view and edit the MySQL Configuration file (my.ini or my.cnf) usingGUI controls

• Accounts: Enables you to create user accounts and assign roles and privileges

• Connections: Displays connections to MySQL Server

• Variables: Displays system and status variables

• Data Dump: Import and export of data

• Logs: Displays server log file entries

The Administrator also displays system and server status. System status includes:

• CPU utilization

• Memory usage

• Connection Health

For server health, the following are displayed:

• Connection Usage

• Traffic

• Query Cache Hit Rate

• Key Efficiency

Page 185: MySQL Workbench

The Startup Tab

177

Figure 8.3. MySQL Workbench - Admin Page

The Startup Tab

The Startup tab has several purposes:

• To display database server status

• To start up and shut down the server

• To display the Startup Message log

• To select whether the server starts when the system starts

Page 186: MySQL Workbench

The Configuration Tab

178

Figure 8.4. Administrator - Startup Tab

The Configuration Tab

The Configuration tab enables you to edit the my.ini or my.cnf configuration file by selecting checkboxes and other GUI controls. This tab also features a number of subtabs, which provide access to varioussub-sections within the configuration file. The subtabs are:

• General

• MyISAM

• InnoDB

• Performance

Page 187: MySQL Workbench

The Accounts Tab

179

• Log Files

• Replication

• Networking

• Security

• Advanced

Figure 8.5. Administrator - Configuration Tab

The Accounts Tab

The Accounts tab has two subtabs:

Page 188: MySQL Workbench

The Accounts Tab

180

• Server Access Management

• Schema Privileges

Server Access Management enables you to list existing user accounts. You can also add and deleteaccounts. You can allocate administrative roles and also set account limits.

Schema Privileges enables you to set specific privileges on a user basis.

Figure 8.6. Administrator - Accounts Tab

Page 189: MySQL Workbench

The Connections Tab

181

Note

In the current version of MySQL Workbench, it is not possible to manage privilegesbelow the schema level. For example, it is not possible to view or manage grants atthe table, column, or procedure level.

Administrative Roles

To aid in assigning privileges to MySQL Server users, MySQL Workbench introduces the concept ofAdministrative Roles. Roles are a quick way of granting a set of privileges to a user, based on the work theuser must carry out on the server. It is also possible to assign multiple roles to a user. To assign roles, clickthe User Account you wish to modify, then click the Administrative Roles tab. Then click the check boxesaccording to the roles you wish to allocate to the user. After you select a role to a user, you will see theaccumulated privileges in the Global Privileges Assigned to User panel. For example, if you select therole BackupAdmin, the privileges granted include EVENT, LOCK TABLES, SELECT, SHOW DATABASES.If you also select the role of ReplicationAdmin, the list of privileges expands to include REPLICATIONCLIENT, REPLICATION SLAVE and SUPER.

These roles are available:

• DBA: Grants all privileges

• MaintenanceAdmin: Grants privileges to maintain the server

• ProcessAdmin: Grants privileges to monitor and kill user processes

• UserAdmin: Grants privileges to create users and reset passwords

• SecurityAdmin: Grants privileges to manage logins and grant and revoke server privileges

• MonitorAdmin: Grants privileges to monitor the server

• DBManager: Grants privileges to manage databases

• DBDesigner: Grants privileges to create and reverse engineer any database schema

• ReplicationAdmin: Grants privileges to set up and manage replication

• BackupAdmin: Grants privileges required to back up databases

The Connections Tab

The Connections tab lists all current connections to the monitored server.

Page 190: MySQL Workbench

The Variables Tab

182

Figure 8.7. Administrator - Connections Tab

The Variables Tab

The Variables tab displays a list of all server and status variables.

Page 191: MySQL Workbench

The Data Dump Tab

183

Figure 8.8. Administrator - Variables Tab

The Data Dump Tab

The Import/Export Server Data tab enables you to create a dump file, or restore data from a dump file.Clicking the Import/Export Server Data action item launches a new Admin page, at the Data Dump tab.

Within the Data Dump tab are three further tabbed windows:

• Export to Disk

• Import from Disk

• Advanced Options

Page 192: MySQL Workbench

The Data Dump Tab

184

Export to Disk

The Export to Disk tab enables you to select the schema and tables to export. You also have the option toexport tables to their own files, or all tables to a single file. Exporting tables to individual files enables youto restore on a per-table basis.

Figure 8.9. Administrator - Export to Disk

Import from Disk

The Import from Disk tab enables you to import a previously exported project. You can select to importa project where tables were stored in individual files. In this case, you will also be able to select which ofthese tables to import. You can also import a project saved to a single file.

Page 193: MySQL Workbench

The Data Dump Tab

185

Figure 8.10. Administrator - Import from Disk

Advanced Export Options

The Advanced Export Options tab contains a number of options to enable you to control the exportoperation. These options control the SQL generated during the operation.

Page 194: MySQL Workbench

The Logs Tab

186

Figure 8.11. Administrator - Advanced Options

The Logs Tab

The Logs tab features two subtabs:

• General

• Slow Query Log

The General tab shows entries from the server's general log file.

The Slow Query Log tab displays entries from the server's slow query log file.

Page 195: MySQL Workbench

The Logs Tab

187

Figure 8.12. Administrator - Logs Tab

Page 196: MySQL Workbench

188

Page 197: MySQL Workbench

189

Chapter 9. Extending Workbench

Table of ContentsGRT and Workbench Data Organization ......................................................................................... 189Modules ......................................................................................................................................... 190Plugins .......................................................................................................................................... 191Adding a GUI to a Plugin Using MForms ........................................................................................ 192The Workbench Scripting Shell ....................................................................................................... 193

Exploring the Workbench Scripting Shell ................................................................................. 193The Shell Window .................................................................................................................. 194The Globals, Classes, and Modules Tabs ............................................................................... 195

Tutorial: Writing Plugins ................................................................................................................. 195

MySQL Workbench provides an extension and scripting system that enables the developer to extendMySQL Workbench capabilities. While the core of MySQL Workbench is developed using C++, it ispossible to harness this core functionality using both the Lua and Python scripting languages. MySQLWorkbench also provides access to a cross-platform GUI library, MForms, which enables the creation ofextensions that feature a graphical user interface.

The extension system enables the following capabilities:

• Automate common tasks

• Extend the Workbench user-interface

• Create plugins (code which can be invoked from the Workbench menu system)

• Manipulate schemata

• Create custom Workbench features

GRT and Workbench Data Organization

The GRT, or Generic RunTime, is the internal system used by Workbench to hold model document data.It is also the mechanism by which Workbench can interact with Modules and Plugins. Workbench modeldata, such as diagrams, schemata, and tables, is stored in a hierarchy of objects that can be accessed byany plugin. The information is represented using standard data types: integers, doubles, strings, dicts, lists,and objects.

The GRT can be accessed using external scripting languages such as Lua and Python. Awareness isrequired of how the GRT data types map into the scripting language. In Python, for example, the GRTinteger, double, and string data types are seen as corresponding Python data types. Lists and dicts arekept in their internal representation, but can generally be treated as Python lists and dicts, and accessed inthe usual way. Objects contain data fields and methods, but the GRT recognizes only objects from a pre-registered class hierarchy.

It is possible to fully examine the classes contained within the GRT using the Workbench ScriptingShell. Dots in class names are changed to underscores in their Python counterparts. For example,db.mysql.Table becomes db_mysql_Table in Python.

The Application Objects Tree (GRT Tree)

Page 198: MySQL Workbench

Modules

190

As mentioned previously, Workbench document data is stored in an object hierarchy. This hierarchy isknown as the GRT Tree. The GRT Tree can be accessed and modified from supported external scriptinglanguages such as Python. Care should be taken when modifying the GRT Tree, to prevent a mistake fromleading to corruption of the document. Backups should be made before manipulating the tree. Read-onlyaccess to the tree is the safest approach, and is sufficient in most cases.

The main nodes in the Application Object Tree

Table 9.1. The main nodes in the Application Object Tree

Node Description

wb.registry Application data such as plugin registry, list of editors, andoptions.

wb.customData A generic dictionary for data you can use to store your owndata. This dictionary is saved and reloaded with Workbenchand is global (not document specific).

wb.options Contains some default options that are used by Workbench.

wb.rdbmsMgmt Internal registry of supported RDBMS modules, known datatypes.

wb.doc The currently loaded model document.

wb.doc.physicalModels[0] The currently loaded model object, containing the databasecatalog and diagrams.

wb.doc.physicalModels[0].catalog The database catalog for the model. Contains the list ofschemata.

wb.doc.physicalModels[0]catalog.schemataList of schemata in the model. Individual schema can beaccessed as a list: schemata[0], schemata[1] ...

wb.doc.physicalModels[0].catalog.schemata[0].tables(.views, .routines, ...)

Lists of tables, views, routines in the schema.

wb.doc.physicalModels[0].diagrams List of EER diagrams in the model.

wb.doc.physicalModels[0].diagrams[0].figures(.layers, .connections, ...)

List of figures, layers, connections (relationships) in thediagram.

Modules

In the GRT Modules are libraries containing a list of functions that are exported for use by code in othermodules, scripts, or Workbench itself. Modules can currently be written in C++, Lua, or Python, but thedata types used for arguments and the return value must be GRT types.

GRT modules are similar to Python modules, but are imported from the built-in grt module, insteadof directly from an external file. The list of modules loaded into the grt module is obtained fromgrt.modules. Modules can be imported in Python using statements such as from grt.modulesimport WbModel.

To export functions as a module from Python code, you must carry out the following steps:

1. The source file must be located in the user modules folder. This path is displayed in the WorkbenchScripting Shell with the label Looking for user plugins in.... It is also possible to install the file usingthe main menu item Scripting, Install Plugin/Module File.

2. The source file name must have the extension _grt.py; for example, my_module_grt.py.

Page 199: MySQL Workbench

Plugins

191

3. Some module metadata must be defined. This can be done using the DefineModule function from thewb module:

from wb import *ModuleInfo = DefineModule(name='MyModule', author='Your Name', version='1.0')

4. Functions to be exported require their signature to be declared. This is achieved using the exportdecorator in the previously created ModuleInfo object:

@ModuleInfo.export(grt.INT, grt.STRING)def checkString(s): ...

For the export statement, the return type is listed first, followed by the input parameter types,specified as GRT typenames. The following typenames can be used:

• grt.INT: An integer value. Also used for boolean values.

• grt.DOUBLE: A floating-point numeric value.

• grt.STRING: UTF-8 or ASCII string data.

• grt.DICT: A key/value dictionary item. Keys must be strings.

• grt.LIST: A list of other values. It is possible to specify the type of the contents as a tuplein the form (grt.LIST, <type-or-class>). For example, (grt.LIST, grt.STRING) fora list of strings. For a list of table objects, the following would be specified: (grt.LIST,grt.classes.db_table).

• grt.OBJECT: An instance of a GRT object or a GRT class object, from grt.classes.

Note that these types are defined in the grt module, which must be imported before they can be used.

The following code snippet illustrates declaring a module that exports a single function:

from wb import *import grt

ModuleInfo = DefineModule(name='MyModule', author="your name", version='1.0')

@ModuleInfo.export(grt.DOUBLE, grt.STRING, (grt.LIST, grt.DOUBLE))def printListSum(message, doubleList): sum = 0 for d in doubleList: sum = sum + d print message, sum return sum

PluginsPlugins are special Modules that are exposed to the user through the Workbench GUI. This is typicallydone using the main menu, or the context-sensitive menu. Much of the MySQL Workbench functionality isimplemented using plugins; for example, table, view, and routine editors are native C++ plugins, as are theforward and reverse engineering wizards. The Administrator facility in MySQL Workbench is implementedentirely as a plugin in Python.

A plugin can be a simple function that performs some action on an input, and ends without furtherinteraction with the user. Examples of this include auto-arranging a diagram, or making batch changes toobjects. To create a simple plugin, the function must be located in a module and declared as a plugin usingthe plugin decorator of the ModuleInfo object.

Page 200: MySQL Workbench

Adding a GUI to a Plugin Using MForms

192

Plugins can have an indefinite runtime, such as when they are driven by the user through a graphical userinterface. This is the case for the various object editors and wizards within MySQL Workbench. Althoughthis latter type of plugin must be declared in the usual way, only the entry point of the plugin will need to beexecuted in the plugin function, as most of the additional functionality will be invoked as a result of the userinteracting with the GUI.

Note

Reloading a plugin requires MySQL Workbench to be restarted.

Declare a plugin using this syntax:

@ModuleInfo.plugin(plugin_name, caption, [input], [groups], [pluginMenu])

These parameters are defined as follows:

• plugin_name: A unique name for the plugin. It may contain only alphanumeric characters, dots, andunderscores.

• caption: A caption to use for the plugin in menus.

• input: An optional list of input arguments.

• groups: Optional list of groups the plugin belongs to. Recognized values are:

• Overview/Utility: The Context menu in the Model Overview.

• Model/Utility: The menu for diagram objects.

• Menu/<category>: The Plugins menu in the main menu.

• pluginMenu: Optional name of a submenu in the Plugins menu where the plugin should appear. Forexample, Catalog, Objects, Utilities. This is equivalent to adding a Menu/<category> in the groups list.

Adding a GUI to a Plugin Using MForms

MySQL Workbench is implemented with a C++ core back-end, and a native front-end for each supportedplatform. Currently the front-end is implemented with Windows Forms on Microsoft Windows, GTK+ onLinux, and Cocoa on Mac OS X. This approach permits the application to have a native look and feel, whilereducing the amount of work required to maintain the project. However, the GUI functionality required byMySQL Workbench can be met by a subset of graphical operations. These are implemented in a cross-platform GUI library, MForms. This further reduces the development effort because plugin developerscan use MForms rather than writing front-end specific code for each supported platform. This also helpsconsistency of operation across all platforms. MForms is coded in C++, but provides a Python interface. Touse it, the Python code must import the mforms module.

MForms Containers

Given the problems of using an absolute coordinate system across different platforms, MForms employscontainers that perform automatic layout. The basic containers that MForms provides include:

• Form: A top-level window which can contain a single control, usually another container. The window willbe sized automatically to fit its contents, but can also be sized statically.

• Box: This is a container that can be filled with one or more controls in a vertical or horizontal layout.Each child control can be set to use either the minimum of required space, or fill the box in the direction

Page 201: MySQL Workbench

The Workbench Scripting Shell

193

of the layout. In the direction perpendicular to the layout, for example vertical in a horizontal layout, thesmallest possible size that can accommodate all child controls will be employed. So, in this example, thesmallest height possible to accommodate the controls would be used.

• Table: This is a container that can organize one or more controls in a grid. The number of rows andcolumns in the table, and the location of controls within the grid, can be set by the developer.

• ScrollView: This is a container that can contain a single child control, and will add scrollbars if thecontents do not fit the available space.

The Workbench Scripting Shell

The Workbench Scripting Shell provides a means for entering and executing scripts. Through the use ofthe scripting shell, MySQL Workbench can support new behavior and data sources using code written inLua and Python. The shell can also be used to explore the current Workbench GRT (Generic RunTime)facilities.

The scripting shell is not only useful for expanding MySQL Workbench. You can use a script file from thescripting shell command line to perform repetitive tasks programmatically.

The default development language is Lua, a lightweight scripting language expressly designed forextending applications. For more information about this language, see lua.org.

The Python language is also supported, further details of this language can be found from the officialPython site.

The programming language to be used in Workbench Scripting Shell can be selected from the General tabof the Workbench Preferences dialog. The Workbench Preferences dialog can be displayed using the mainmenu item Edit, Preferences.

Exploring the Workbench Scripting Shell

To open the Workbench Scripting Shell, select Scripting, Scripting Shell from the main menu. You canalso open the Workbench Scripting Shell using the Control+F3 key combination on Windows and Linux,Command+F3 on Mac OS X, or by clicking the shell button above the EER diagram navigator. TheWorkbench Scripting Shell will then open in a new dialog.

The following screenshot shows the Workbench Scripting Shell dialog.

Page 202: MySQL Workbench

The Shell Window

194

Figure 9.1. The Workbench Scripting Shell

The Shell Window

The Workbench Scripting Shell is primarily used for running Lua or Python scripts or typing commands inthese languages directly. However, you can also use it to access the Workbench Scripting Shell ScriptingLibrary functions and global functions and objects. To see the available commands, type “?”. You can alsocut and paste text to and from the shell window.

While individual commands can be entered into the shell, it is also possible to run a longer script, storedin an external file, using the main menu item Scripting, Run Workbench Script File. When scripts are runoutside of the shell, to see the output use the main menu item View, Output.

It is also possible to run script files directly from the shell. For details on running script files, type ? run atthe Workbench Scripting Shell prompt. The following message is displayed:

Shell Command - shell.run ------------------------- Load and execute a lua script file.

Page 203: MySQL Workbench

The Globals, Classes, and Modules Tabs

195

run filename

Parameters: filename File that should be loaded and executed.

Examples: run scripts/test.lua Runs the script scripts/test.lua.

Within the Workbench Scripting Shell, on the left side panel, are three tabs: Globals, Classes, andModules. Discussion of these additional tabs follows.

The Globals, Classes, and Modules Tabs

The Workbench Scripting Shell features the Globals, Classes and Modules tabs, in addition to the mainShell tab.

The Globals Tab

At the top of the window is a list that is used to select the starting point, or root, of the GRT Globals treedisplayed beneath it. By default, this starting point is the root of the tree, that is, '/'. You can expandor collapse the GRT Globals tree as desired. The GRT Globals tree is the structure in which MySQLWorkbench stores document data. Clicking any item results in its name and value being displayed in thepanel below the tree.

The Classes Tab

A class is a user-defined data type formed by combining primitive data types: integers, doubles, strings,dicts, lists, and objects. This tab shows the definitions of the classes used by the objects in the Modulestab. Clicking a class causes a brief description of the class to be displayed in a panel below the classesexplorer.

When the Classes tab is selected, the list displays the following items:

• Group by Name: Group by the object name

• Group by Hierarchy: Group by inheritance

• Group by Package: Group by functionality

The default view for this tab is Group By Name. This view shows all the different objects arrangedalphabetically. Click the + icon or double-click a package to show the properties of the struct.

If you switch to the hierarchical view, you will see GrtObject: the parent object from which all otherobjects are derived.

The Modules Tab

The Modules tab enables you to browse the MySQL Workbench installed modules and their functions.Clicking a module within the explorer causes its details to be displayed in a panel below the explorer. Thisfacility is useful for exploring the available modules, and their supported functions. It is also a way to checkwhether custom modules have been correctly installed.

Tutorial: Writing Plugins

This tutorial shows you how to extend MySQL Workbench by creating a plugin.

Page 204: MySQL Workbench

Tutorial: Writing Plugins

196

The Sample Plugin

EER Diagrams are useful for visualizing complex database schemata. They are often created for existingdatabases, to clarify their purpose or document them. MySQL Workbench provides facilities for reverseengineering existing databases, and then creating an EER Diagram automatically. In this case, relationshiplines between foreign keys in the table will automatically be drawn. This graphical representation makesthe relationships between the tables much easier to understand. However, one of the most popularstorage engines for MySQL, MyISAM, does not include support for foreign keys. This means that MyISAMtables that are reverse engineered will not automatically have the relationship lines drawn betweentables, making the database harder to understand. The plugin that will be created in this tutorial getsaround this problem by using the fact that a naming convention is very often used for foreign keys: tablename_primarykeyname. Using this convention, foreign keys can automatically be created after adatabase is reverse engineered, which will result in relationship lines being drawn in the EER diagram.

Algorithm

The basic algorithm for this task would be as follows:

for each table in the schema for each column in the table look for another table whose name and primary key name match the current column name if such a table is found, add a foreign key referencing it

As iterating the complete table list to find a match can be slow for models with a large number of tables, itis necessary to optimize by pre-computing all possible foreign key names in a given schema.

import grt

def auto_create_fks(schema): fk_name_format = "%(table)s_%(pk)s" possible_fks = {} # create the list of possible foreign keys from the list of tables for table in schema.tables: if table.primaryKey: format_args = {'table':table.name, 'pk':table.primaryKey.name} fkname = fk_name_format % format_args possible_fks[fkname] = table

# go through all tables in schema, this time to find columns that may be a fk for table in schema.tables: for column in table.columns: if possible_fks.has_key(column.name): ref_table = possible_fks[column.name] if ref_table.primaryKey.formattedType != column.type: continue fk = table.createForeignKey(column.name+"_fk") fk.referencedTable = ref_table fk.columns.append(column) fk.referencedColumn.append(ref_table.primaryKey) print "Created foreign key %s from %s.%s to %s.%s" % (fk.name, table.name, column.name, ref_table.name, ref_table.primaryKey.name)

auto_create_fks(grt.root.wb.doc.physicalModels[0].catalog.schemata[0])

Creating a Plugin from a Script

To create a plugin from an arbitrary script, it is first necessary to make the file a module, and export therequired function from it. It is then necessary to declare the module as a plugin, and specify the return typeand input arguments.

from wb import *import grt

Page 205: MySQL Workbench

Tutorial: Writing Plugins

197

ModuleInfo = DefineModule(name="AutoFK", author="John Doe", version="1.0")

@ModuleInfo.plugin("sample.createGuessedForeignKeys", caption="Create Foreign Keys from ColumnNames",input=[wbinputs.objectOfClass("db.mysql.schema")], groups=["Overview/Utility"])@ModuleInfo.export(grt.INT, grt.classes.db_mysql_Schema)def auto_create_fks(schema): ...

With the addition of the preceding code, the auto_create_fks() function is exported and will be addedto the schema context menu in the model overview. When invoked, it receives the currently selectedschema as its input.

Page 206: MySQL Workbench

198

Page 207: MySQL Workbench

199

Chapter 10. Keyboard ShortcutsThe following tables list keyboard shortcuts for MySQL Workbench commands. Modifier in the tablesstands for the platform-specific modifier key. This is Command on Mac OS X, Control on other platforms.On Mac OS X, the Alt key is Option.

There are keyboard shortcut tables for the File, Edit, View, Arrange, Model, Query, Database, Scripting,Help, and EER Diagram Mode menus.

File Menu

Table 10.1. File menu keyboard shortcuts

Function Keyboard Shortcut Context

New Model Modifier+N All

Open Model Modifier+O All

Open SQL Script Modifier+Shift+O SQL Editor

Close Tab Modifier+W All

Save Model Modifier+S Model

Save Script Modifier+S SQL Editor

Save Model As Modifier+Shift+S Model

Save Script As Modifier+Shift+S SQL Editor

Forward Engineer SQLCREATE Script

Modifier+Shift+G Model

Forward Engineer SQL ALTERScript

Modifier+Alt+Y Model

Synchronize With SQLCREATE Script

Modifier+Shift+Y Model

Print Modifier+P EER Diagram mode only

Exit Modifier+Q All

Edit Menu

Table 10.2. Edit menu keyboard shortcuts

Function Keyboard Shortcut Context

Undo Modifier+Z Model, EER Diagram

Redo Modifier+Y, Modifier+Shift+Z (Mac OS X) Model, EER Diagram

Cut Modifier+X All

Copy Modifier+C All

Paste Modifier+V All

Delete Modifier+Delete, Command+BackSpace(Mac OS X)

All

Edit Selected Modifier+E Model, EER Diagram

Edit Selected in New Window Modifier+Shift+E Model, EER Diagram

Select All Modifier+A EER Diagram

Page 208: MySQL Workbench

200

Function Keyboard Shortcut Context

Find Modifier+F All

Find Advanced Modifier+Alt+F All

Find Next F3 All

Find Previous Shift+F3 All

Search and Replace Modifier+Shift+F All

View Menu

Table 10.3. View menu keyboard shortcuts

Function Keyboard Shortcut Context

Output Window Modifier+F2, Modifier+Option+2 (Mac OSX)

All

Set Marker n Modifier+Shift+n (n is integer 1..9) EER Diagram

Go to Marker n Modifier+n (n is integer 1..9) EER Diagram

Arrange Menu

Table 10.4. Arrange menu keyboard shortcuts

Function Keyboard Shortcut Context

Bring to Front Modifier+Shift+F EER Diagram

Send to Back Modifier+Shift+B EER Diagram

Model Menu

Table 10.5. Model menu keyboard shortcuts

Function Keyboard Shortcut Context

Add Diagram Modifier+T Model, EER Diagram

Validate All Modifier+Alt+V Model, EER Diagram

Validate All (MySQL) Modifier+Alt+B Model, EER Diagram

Model Options Command+Alt+, (Shortcut available onlyon Mac OS X)

Model, EER Diagram

Query Menu

Table 10.6. Query menu keyboard shortcuts

Function Keyboard Shortcut Context

Execute statement Modifier+Return SQL Editor

Execute statements Modifier+Shift+Return SQL Editor

New Tab Modifier+T SQL Editor

Database Menu

Table 10.7. Database menu keyboard shortcuts

Function Keyboard Shortcut Context

Query Database Modifier+U All

Page 209: MySQL Workbench

201

Function Keyboard Shortcut Context

Reverse Engineer Modifier+R Model, EER Diagram

Forward Engineer Modifier+G Model, EER Diagram

Synchronize Model Modifier+Y Model, EER Diagram

Scripting Menu

Table 10.8. Scripting menu keyboard shortcuts

Function Keyboard Shortcut Context

Scripting Shell Modifier+F3, Modifier+Option+3 (on MacOS X)

All

Run Workbench Script File Modifier+Shift+R All

Help Menu

Table 10.9. Help menu keyboard shortcuts

Function Keyboard Shortcut Context

Help Index F1, Command+Option+question (on MacOS X)

All

EER Diagram Mode

In the EER Diagram view, a number of other keyboard shortcuts are available.

Table 10.10. EER diagram mode keyboard shortcuts

Function Keyboard Shortcut

Selection tool Escape

Hand tool H

Delete tool D

Layer tool L

Note tool N

Image tool I

Table tool T

View tool V

Routine Group tool G

Non-Identifying Relationship 1:1 1

Non-Identifying Relationship 1:n 2

Identifying Relationship 1:1 3

Identifying Relationship 1:n 4

Identifying Relationship n:m 5

Relationship Using Existing Columns 6

Page 210: MySQL Workbench

202

Page 211: MySQL Workbench

203

Chapter 11. MySQL Utilities

Table of ContentsIntroduction .................................................................................................................................... 203

Introduction to MySQL Utilities ................................................................................................ 203Connection Parameters .......................................................................................................... 204Introduction to extending the MySQL Utilities ........................................................................... 205

Commands .................................................................................................................................... 211mysql.utilities.command.grep — Search Databases for Objects ................................................ 211mysql.utilities.command.proc — Search Processes on Servers ................................................. 212

Manual Pages ................................................................................................................................ 214Brief overview of command-line utilities ................................................................................... 214mut - MySQL Utilities Testing ................................................................................................. 216mysqldbcompare - Compare Two Databases and Identify Differences .................................... 218mysqldbcopy - Copy Database Objects Between Servers ...................................................... 225mysqldbexport - Export Object Definitions or Data from a Database ...................................... 229mysqldbimport - Import Object Definitions or Data into a Database ....................................... 236mysqldiff - Identify Differences Among Database Objects .................................................... 239mysqldiskusage - Show Database Disk Usage .................................................................... 243mysqlfailover - Automatic replication health monitoring and failover ..................................... 246mysqlindexcheck - Identify Potentially Redundant Table Indexes .......................................... 253mysqlmetagrep - Search Database Object Definitions ........................................................... 255mysqlprocgrep - Search Server Process Lists ...................................................................... 259mysqlreplicate - Set Up and Start Replication Between Two Servers .................................. 262mysqlrpladmin - Administration utility for MySQL replication ................................................. 265mysqlrplcheck - Check Replication Prerequisities ................................................................ 273mysqlrplshow - Show Slaves for Master Server ................................................................... 276mysqlserverclone - Clone Existing Server to Create New Server ......................................... 279mysqlserverinfo - Display Common Diagnostic Information from a Server ............................ 281mysqluserclone - Clone Existing User to Create New User .................................................. 283

Parsers .......................................................................................................................................... 285mysql.utilities.parser — Parse MySQL Log Files ...................................................................... 285

This chapter describes the MySQL Utilities for MySQL Workbench, a set of Python tools for working withMySQL Server.

Introduction

Introduction to MySQL Utilities

What are the MySQL Utilities?

It is a package of utilities that are used for maintenance and administration of MySQL servers. Theseutilities encapsulate a set of primitive commands, and bundles them so they can be used to perform macrooperations with a single command. They can be installed via MySQL Workbench, or as a standalonepackage.

The utilities are written in Python, available under the GPLv2 license, and are extendable using thesupplied library.

Page 212: MySQL Workbench

Connection Parameters

204

How do we access the MySQL Utilities?

There are two ways to access the utilities from within the MySQL Workbench. Either use Plugins ->StartShellforMySQLUtilities from the main Workbench toolbar, or click the MySQL Utilities iconfrom the main Workbench page. Both methods will open a terminal/shell window, and list the availablecommands.

You can launch any of the utilities listed by typing the name of the command. To find out what options areavailable, use the option, or read the appropriate manual page.

Connection Parameters

To connect to a server, it is necessary to specify connection parameters such as user name, host name,password, and perhaps also port or socket.

Whenever connection parameters are required, they can be specified three different ways:

• As a dictionary containing the connection parameters.

• As a connection specification string containing the connection parameters.

• As a Server instance.

When providing the connection parameters as a dictionary, the parameters are passed unchanged tothe connector’s connect function. This enables you to pass parameters not supported through the otherinterfaces, but at least these parameters are supported:

• user

The name of the user to connect as. The default if no user is supplied is login name of the user, asreturned by getpass.getuser.

• passwd

The password to use when connecting. The default if no password is supplied is the empty password.

• host

The domain name of the host or the IP address. The default iIf no host name is provided is ‘localhost’.This field accepts host names, and IPv4 and IPv6 addresses. It also accepts quoted values which arenot validated and passed directly to the calling methods. This enables users to specify host names andIP addresses that are outside of the supported validation mechanisms.

• port

The port to use when connecting to the server. The default if no port is supplied is 3306 (which is thedefault port for the MySQL server as well).

• unix_socket

The socket to connect to (instead of using the host and port parameters).

Providing the connection parameters as a string requires the string to have the formatuser[:passwd]@host[:port][:socket], where some values are optional. If a connectionspecification string is provided, it is parsed using the options.parse_connection function.

Page 213: MySQL Workbench

Introduction to extending the MySQL Utilities

205

Introduction to extending the MySQL Utilities

Administration and maintenance on the MySQL server can at times be complicated. Sometimes tasksrequire tedious or even repetitive operations that can be time consuming to type and re-type. For thesereasons and more, the MySQL Utilities were created to help both beginners and experienced databaseadministrators perform common tasks.

What are the internals of the MySQL Utilities?

MySQL Utilities are designed as a collection of easy to use Python scripts that can be combined to providemore powerful features. Internally, the scripts use the mysql.utilities module library to perform its varioustasks. Since a library of common functions is available, it is easy for a database administrator to createscripts for common tasks. These utilities are located in the /scripts folder of the installation or sourcetree.

If you have a task that is not met by these utilities or one that can be met by combining one or more ofthe utilities or even parts of the utilities, you can easily form your own custom solution. The followingsections present an example of a custom utility, discussing first the anatomy of a utility and then what themysql.utilities module library has available.

Anatomy of a MySQL Utility

MySQL Utilities use a three-tier module organization. At the top is the command script, which resides in the/scripts folder of the installation or source tree. Included in the script is a command module designed toencapsulate and isolate the bulk of the work performed by the utility. The command module resides in the/mysql/utilities/command folder of the source tree. Command modules have names similar to thescript. A command module includes classes and methods from one or more common modules where theabstract objects and method groups are kept. The common modules reside in the /mysql/utilities/common folder of the source tree. The following illustrates this arrangement using the mysqlserverinfoutility:

/scripts/mysqlserverinfo.py | +--- /mysql/utilities/command/serverinfo.py | +--- /mysql/utilities/common/options.py | +--- /mysql/utilities/common/server.py | +--- /mysql/utilities/common/tools.py | +--- /mysql/utilities/common/format.py

Each utility script is designed to process the user input and option settings and pass them on to thecommand module. Thus, the script contains only such logic for managing and validating options. The workof the operation resides in the command module.

Command modules are designed to be used from other Python applications. For example, one couldcall the methods in the serverinfo.py module from another Python script. This enables developers tocreate their own interfaces to the utilties. It also permits developers to combine several utilities to form amacro-level utility tailored to a specified need. For example, if there is a need to gather server informationas well as disk usage, it is possible to import the serverinfo.py and diskusage.py modules andcreate a new utility that performs both operations.

Common modules are the heart of the MySQL Utilities library. These modules contain classes that abstractMySQL objects, devices, and mechanisms. For example, there is a server class that contains operations tobe performed on servers, such as connecting (logging in) and running queries.

Page 214: MySQL Workbench

Introduction to extending the MySQL Utilities

206

The MySQL Utilities Library

While the library is growing, the following lists the current common modules and the major classes andmethods as of the 1.0.1 release:

Module Class/Method Description---------- ------------------------- ----------------------------------------database Database Perform database-level operationsdbcompare get_create_object Retrieve object create statement diff_objects Diff definitions of two objects check_consistency Check data consistency of two tablesformat format_tabular_list Format list in either GRID or delimited format to a file format_vertical_list Format list in a vertical format to a file print_list Print list based on format (CSV, GRID, TAB, or VERTICAL)options setup_common_options Set up option parser and options common to all MySQL Utilities add_skip_options Add common --skip options check_skip_options Check skip options for validity check_format_option Check format option for validity add_verbosity Add verbosity and quiet options check_verbosity Check whether both verbosity and quiet options are being used add_difftype Add difftype option add_engines Add engine, default-storage-engine options check_engine_options Check whether storage engines listed in options exist parse_connection Parse connection valuesrpl Replication Establish replication connection between a master and a slave get_replication_tests Return list of replication test function pointersserver get_connection_dictionary Get connection dictionary find_running_servers Check whether any servers are running on the local host connect_servers Connect to source and destination server Server Connect to running MySQL server and perform server-level operationstable Index Encapsulate index for a given table as defined by SHOW INDEXES Table Encapsulate table for given database to perform table-level operationstools get_tool_path Search for MySQL tool and return its full path delete_directory Remove directory (folder) and contentsuser parse_user_host Parse user, passwd, host, port from user:passwd@host User Clone user and its grants to another user and perform user-level operations

General Interface Specifications and Code Practices

The MySQL Utilities are designed and coded using mainstream coding practices and techniques commonto the Python community. Effort has been made to adhere to the most widely accepted specifications andtechniques. This includes limiting the choice of libraries used to the default libraries found in the Pythondistributions. This ensures easier installation, enhanced portability, and fewer problems with missinglibraries. Similarly, external libraries that resort to platform-specific native code are also not used.

The class method and function signatures are designed to make use of a small number of requiredparameters and all optional parameters as a single dictionary. Consider the following method:

def do_something_wonderful(position, obj1, obj2, options={}):

Page 215: MySQL Workbench

Introduction to extending the MySQL Utilities

207

"""Does something wonderful

A fictional method that does something to object 2 based on the location of something in object 1.

position[in] Position in obj1 obj1[in] First object to manipulate obj2[in] Second object to manipulate options[in] Option dictionary width width of printout (default 75) iter max iterations (default 2) ok_to_fail if True, do not throw exception (default True)

Returns bool - True = success, Fail = failed """

This example is typical of the methods and classes in the library. Notice that this method has threerequired parameters and a dictionary of options that may exist.

Each method and function that uses this mechanism defines its own default values for the items in thedictionary. A quick look at the method documentation shows the key names for the dictionary. This can beseen in the preceding example where the dictionary contains three keys and the documentation lists theirdefaults.

To call this method and pass different values for one or more of the options, the code may look like this:

opt_dictionary = { 'width' : 100, 'iter' : 10, 'ok_to_fail' : False,}result = do_something_wonderful(1, obj_1, obj_2, opt_dictionary)

The documentation block for the preceding method is the style used throughout the library.

Example

Now that you are familiar with the MySQL utilities and the supporting library modules, let us take a look atan example that combines some of these modules to solve a problem.

Suppose that you want to develop a new database solution and need to use real world data and useraccounts for testing. The mysqlserverclone MySQL utility looks like a possibility but it makes only aninstance of a running server. It does not copy data. However, mysqldbcopy makes a copy of the dataand mysqluserclone clones the users. You could run each of these utilities in sequence, and that wouldwork, but we are lazy at heart and want something that not only copies everything but also finds it for us.That is, we want a one-command solution.

The good news is that this is indeed possible and very easy to do. Let us start by breaking the problemdown into its smaller components. In a nutshell, we must perform these tasks:

• Connect to the original server

• Find all of the databases

• Find all of the users

• Make a clone of the original server

• Copy all of the databases

Page 216: MySQL Workbench

Introduction to extending the MySQL Utilities

208

• Copy all of the users

If you look at the utilities and the modules just listed, you see that we have solutions and primitives for eachof these operations. So you need not even call the MySQL utilities directly (although you could). Now let usdive into the code for this example.

The first task is to connect to the original server. We use the same connection mechanism as the otherMySQL utilities by specifying a --server option like this:

parser.add_option("--server", action="store", dest="server", type="string", default="root@localhost:3306", help="connection information for original server in " + \ "the form: <user>:<password>@<host>:<port>:<socket>")

Once we process the options and arguments, connecting to the server is easy: Use theparse_connection method to take the server option values and get a dictionary with the connectionvalues. All of the heavy diagnosis and error handling is done for us, so we just need to check forexceptions:

from mysql.utilities.common.options import parse_connection

try: conn = parse_connection(opt.server)except: parser.error("Server connection values invalid or cannot be parsed.")

Now that we have the connection parameters, we create a class instance of the server using the Serverclass from the server module and then connect. Once again, we check for exceptions:

from mysql.utilities.common.server import Server

server_options = { 'conn_info' : conn, 'role' : "source",}server1 = Server(server_options)try: server1.connect()except UtilError, e: print "ERROR:", e.errmsg

The next item is to get a list of all of the databases on the server. We use the new server class instance toretrieve all of the databases on the server:

db_list = []for db in server1.get_all_databases(): db_list.append((db[0], None))

If you wanted to supply your own list of databases, you could use an option like the following. You couldalso add an else clause which would enable you to either get all of the databases by omitting the --databases option or supply your own list of databases (for example, --databases=db1,db2,db3):

parser.add_option("-d", "--databases", action="store", dest="dbs_to_copy", type="string", help="comma-separated list of databases " "to include in the copy (omit for all databases)", default=None)

if opt.dbs_to_copy is None: for db in server1.get_all_databases(): db_list.append((db[0], None))else: for db in opt.dbs_to_copy.split(","): db_list.append((db, None))

Page 217: MySQL Workbench

Introduction to extending the MySQL Utilities

209

Notice we are creating a list of tuples. This is because the dbcopy module uses a list of tuples in the form(old_db, new_db) to enable you to copy a database to a new name. For our purposes, we do not want arename so we leave the new name value set to None.

Next, we want a list of all of the users. Once again, you could construct the new solution to be flexible bypermitting the user to specify the users to copy. We leave this as an exercise.

In this case, we do not have a primitive for getting all users created on a server. But we do have the abilityto run a query and process the results. Fortunately, there is a simple SQL statement that can retrieve all ofthe users on a server. For our purposes, we get all of the users except the root and anonymous users, thenadd each to a list for processing later:

users = server1.exec_query("SELECT user, host " "FROM mysql.user " "WHERE user != 'root' and user != ''")for user in users: user_list.append(user[0]+'@'+user[1])

Now we must clone the original server and create a viable running instance. When you examinethe mysqlserverclone utility code, you see that it calls another module located in the /mysql/utilities/command sub folder. These modules are where all of the work done by the utilities take place.This enables you to create new combinations of the utilities by calling the actual operations directly. Let’sdo that now to clone the server.

The first thing you notice in examining the serverclone module is that it takes a number of parametersfor the new server instance. We supply those in a similar way as options:

parser.add_option("--new-data", action="store", dest="new_data", type="string", help="the full path to the location " "of the data directory for the new instance")parser.add_option("--new-port", action="store", dest="new_port", type="string", default="3307", help="the new port " "for the new instance - default=%default")parser.add_option("--new-id", action="store", dest="new_id", type="string", default="2", help="the server_id for " "the new instance - default=%default")

from mysql.utilities.command import serverclone

try: res = serverclone.clone_server(conn, opt.new_data, opt.new_port, opt.new_id, "root", None, False, True)except exception.UtilError, e: print "ERROR:", e.errmsg exit(1)

As you can see, the operation is very simple. We just added a few options we needed like --new-data,--new-port, and --new-id (much like mysqlserverclone) and supplied some default values for theother parameters.

Next, we need to copy the databases. Once again, we use the command module for mysqldbcopy to doall of the work for us. First, we need the connection parameters for the new instance. This is provided inthe form of a dictionary. We know the instance is a clone, so some of the values are going to be the sameand we use a default root password, so that is also known. Likewise, we specified the data directory and,since we are running on a Linux machine, we know what the socket path is. (For Windows machines, youcan leave the socket value None.) We pass this dictionary to the copy method:

dest_values = { "user" : conn.get("user"), "passwd" : "root", "host" : conn.get("host"),

Page 218: MySQL Workbench

Introduction to extending the MySQL Utilities

210

"port" : opt.new_port, "unix_socket" : os.path.join(opt.new_data, "mysql.sock")}

In this case, a number of options are needed to control how the copy works (for example, if any objects areskipped). For our purposes, we want all objects to be copied so we supply only the minimal settings and letthe library use the defaults. This example shows how you can ‘fine tune’ the scripts to meet your specificneeds without having to specify a lot of additional options in your script. We enable the quiet option on soas not to clutter the screen with messages, and tell the copy to skip databases that do not exist (in case wesupply the --databases option and provide a database that does not exist):

options = { "quiet" : True, "force" : True}

The actual copy of the databases is easy. Just call the method and supply the list of databases:

from mysql.utilities.command import dbcopy

try: dbcopy.copy_db(conn, dest_values, db_list, options)except exception.UtilError, e: print "ERROR:", e.errmsg exit(1)

Lastly, we copy the user accounts. Once again, we must provide a dictionary of options and call thecommand module directly. In this case, the userclone module provides a method that clones one user toone or more users so we must loop through the users and clone them one at a time:

from mysql.utilities.command import userclone

options = { "overwrite" : True, "quiet" : True, "globals" : True}

for user in user_list: try: res = userclone.clone_user(conn, dest_values, user, (user,), options) except exception.UtilError, e: print "ERROR:", e.errmsg exit(1)

We are done. As you can see, constructing new solutions from the MySQL utility command and commonmodules is easy and is limited only by your imagination.

Enhancing the Example

A complete solution for the example named copy_server.py is located in the /docs/intro/examples folder. It is complete in so far as this document explains, but it can be enhanced in a numberof ways. The following briefly lists some of the things to consider adding to make this example utility morerobust.

• Table locking: Currently, databases are not locked when copied. To achieve a consistent copy of thedata on an active server, you may want to add table locking or use transactions (for example, if you areusing InnoDB) for a more consistent copy.

• Skip users not associated with the databases being copied.

Page 219: MySQL Workbench

Commands

211

• Do not copy users with only global privileges.

• Start replication after all of the users are copied (makes this example a clone and replicate scale outsolution).

• Stop new client connections to the server during the copy.

Conclusion

If you find some primitives missing or would like to see more specific functionality in the library or scripts,please contact us with your ideas or better still, write them yourselves! We welcome all suggestions incode or text. To file a feature request or bug report, visit http://bugs.mysql.com. For discussions, visit http://forums.mysql.com/list.php?155.

Commands

mysql.utilities.command.grep — Search Databases for Objects

This module provides utilities to search for objects on a server. The module defines a set of object typesthat can be searched by searching the fields of each object. The notion of an object field is very looselydefined and means any names occurring as part of the object definition. For example, the fields of a tableinclude the table name, the column names, and the partition names (if it is a partitioned table).

Constants

The following constants denote the object types that can be searched.

• mysql.utilities.command.grep.ROUTINE

• mysql.utilities.command.grep.EVENT

• mysql.utilities.command.grep.TRIGGER

• mysql.utilities.command.grep.TABLE

• mysql.utilities.command.grep.DATABASE

• mysql.utilities.command.grep.VIEW

• mysql.utilities.command.grep.USER

The following constant is a sequence of all the object types that are available. It can be used to generate aversion-independent list of object types that can be searched; for example, options and help texts.

• mysql.utilities.command.grep.OBJECT_TYPES

Classes

class mysql.utilities.command.grep.ObjectGrep(pattern[, database_pattern=None,types=OBJECT_TYPES, check_body=False, use_regexp=False])

Search MySQL server instances for objects where the name (or content, for routines, triggers, or events)matches a given pattern.

sql() → string

Return the SQL code for executing the search in the form of a SELECT statement.

Page 220: MySQL Workbench

mysql.utilities.command.proc — Search Processes on Servers

212

Returns: SQL code for executing the operation specified bythe options.

Return type: string

execute(connections[, output=sys.output, connector=mysql.connector])

Execute the search on each of the connections in turn and print an aggregate of the result as a grid table.

Parameters: • connections – Sequence of connection specifiersto send the query to

• output – File object to use for writing the result

• connector – Connector to use for connecting tothe servers

mysql.utilities.command.proc — Search Processes on Servers

This module searches processes on a server and optionally kills either the query or the connection for allmatching processes.

Processes are matched by searching the fields of the INFORMATION_SCHEMA.PROCESSLIST table(which is available only for servers from MySQL 5.1.7 and later). Internally, the module operates byconstructing a SELECT statement for finding matching processes, and then sending it to the server.Instead of performing the search, the module can return the SQL code that performs the query. This canbe useful if you want to execute the query later or feed it to some other program that processes SQLqueries further.

Constants

The following constants correspond to columns in the INFORMATION_SCHEMA.PROCESSLIST table.They indicate which columns to examine when searching for processes matching the search conditions.

• mysql.utilities.command.proc.ID

• mysql.utilities.command.proc.USER

• mysql.utilities.command.proc.HOST

• mysql.utilities.command.proc.DB

• mysql.utilities.command.proc.COMMAND

• mysql.utilities.command.proc.TIME

• mysql.utilities.command.proc.STATE

• mysql.utilities.command.proc.INFO

The following constants indicate actions to perform on processes that match the search conditions.

• mysql.utilities.command.proc.KILL_QUERY

Kill the process query

• mysql.utilities.command.proc.KILL_CONNECTION

Page 221: MySQL Workbench

mysql.utilities.command.proc — Search Processes on Servers

213

Kill the process connection

• mysql.utilities.command.proc.PRINT_PROCESS

Print the processes

Classes

class mysql.utilities.command.proc.ProcessGrep(matches, actions=[], use_regexp=False)

This class searches the INFORMATION_SCHEMA.PROCESSLIST table for processes on MySQL serversand optionally kills them. It can both be used to actually perform the search or kill operation, or to generatethe SQL statement for doing the job.

To kill all queries with user ‘mats’, the following code can be used:

>>> from mysql.utilities.command.proc import *>>> grep = ProcessGrep(matches=[(USER, "mats")], actions=[KILL_QUERY])>>> grep.execute("[email protected]", "[email protected]")

Parameters: • matches (List of (var, pat) pairs) – Sequence offield comparison conditions. In each condition, varis one of the constants listed earlier that specifyPROCESSLIST table fields and pat is a pattern.For a process to match, all field conditions mustmatch.

sql([only_body=False])

Return the SQL code for executing the search (and optionally, the kill).

If only_body is True, only the body of the function is shown. This is useful if the SQL code is to be usedwith other utilities that generate the routine declaration. If only_body is False, a complete procedure willbe generated if there is any kill action supplied, and just a select statement if it is a plain search.

Parameters: • only_body (boolean) – Show only the body of theprocedure. If this is False, a complete procedureis returned.

Returns: SQL code for executing the operation specified bythe options.

Return type: string

execute(connections, ...[, output=sys.stdout, connector=mysql.connector])

Execute the search on each of the connections supplied. If output is not None, the value is treated as afile object and the result of the execution is printed on that stream. Note that the output and connectorarguments must be supplied as keyword arguments. All other arguments are treated as connectionspecifiers.

Parameters: • connections – Sequence of connection specifiersto send the search to

• output – File object to use for writing the result

• connector – Connector to use for connecting tothe servers

Page 222: MySQL Workbench

Manual Pages

214

Manual Pages

Brief overview of command-line utilities

This is a brief overview of the MySQL command-line utilities. See their respective manual pages for furtherdetails and examples:

• mysqldbcompare

• Compare databases on two servers or the same server

• Compare definitions and data

• Generate a difference report

• Generate SQL transformation statements

• mysqldbcopy

• Copy databases between servers

• Clone databases on the same server

• Supports rename

• mysqldbexport

• Export metadata and/or data from one or more databases

• Formats: SQL, CSV, TAB, Grid, Vertical

• mysqldbimport

• Import metadata and data from one or more files

• Reads all formats from mysqldbexport

• mysqldiff

• Compare object definitions

• Generate a difference report

• mysqldiskusage

• Show disk usage for databases

• Generate reports in SQL, CSV, TAB, Grid, Vertical

• mysqlfailover

• Performs replication health monitoring

• Provides automatic failover on a replication topology

• Uses Global Transaction Identifiers (GTID, MySQL Server 5.6.5+)

• mysqlindexcheck

Page 223: MySQL Workbench

Brief overview of command-line utilities

215

• Read indexes for one or more tables

• Check for redundant and duplicate indexes

• Generate reports in SQL, CSV, TAB, Grid, Vertical

• mysqlmetagrep

• Search metadata

• Regexp, database search

• Generate SQL statement for search query

• mysqlprocgrep

• Search process information

• Generate SQL statement for search

• Kill processes that match query

• mysqlreplicate

• Setup replication

• Start from beginning, current, specific binlog, pos

• mysqlrpladmin

• Administers the replication topology

• Allows recovery of the master

• Commands include elect, failover, gtid, health, start, stop, and switchover

• mysqlrplcheck

• Check replication configuration

• Tests binary logging on master

• mysqlrplshow

• Show slaves attached to master

• Can search recursively

• Show the replication topology as a graph or list

• mysqlserverclone

• Start a new instance of a running server

• mysqlserverinfo

• Show server information

• Can search for running servers on a host

Page 224: MySQL Workbench

mut - MySQL Utilities Testing

216

• Access online or offline servers

• mysqluserclone

• Clone a user account, to the same or different server

• Show user grants

• mut

• Tests for all utilities

• Similar to MTR

• Comparative and value result support

• Tests written as Python classes

mut - MySQL Utilities Testing

SYNOPSIS

mut [options] [suite_name.]test_name ...

DESCRIPTION

This utility executes predefined tests to test the MySQL Utilities. The tests are located under the /mysql-test directory and divided into suites (stored as folders). By default, all tests located in the /t folder areconsidered the ‘main’ suite.

You can select any number of tests to run, select one or more suites to restrict the tests, exclude suitesand tests, and specify the location of the utilities and tests.

The utility requires the existence of at least one server to clone for testing purposes. You must specify atleast one server, but you may specify multiple servers for tests designed to use additional servers.

The utility has a special test suite named ‘performance’ where performance-related tests are placed. Thissuite is not included by default and must be specified with the --suite option to execute the performancetests.

OPTIONS

mut accepts the following command-line options:

• --help

Display a help message and exit.

• --do-tests=<prefix>

Execute all tests that begin with prefix.

• --force

Do not abort when a test fails.

• --record

Page 225: MySQL Workbench

mut - MySQL Utilities Testing

217

Record the output of the specified test if successful. With this option, you must specify exactly one test torun.

• --server=<server>

Connection information for the server to use in the tests, in <user>[:<passwd>]@<host>[:<port>][:<socket>] format. Use this option multiple times to specify multiple servers.

• --skip-long

Exclude tests that require greater resources or take a long time to run.

• --skip-suite=<name>

Exclude the named test suite. Use this option multiple times to specify multiple suites.

• --skip-test=<name>

Exclude the named test. Use this option multiple times to specify multiple tests.

• --skip-tests=<prefix>

Exclude all tests that begin with prefix.

• --sort

Execute tests sorted by suite.name either ascending (asc) or descending (desc). Default is ascending(asc).

• --start-port=<port>

The first port to use for spawned servers. If you run the entire test suite, you may see up to 12 newinstances created. The default is to use ports 3310 to 3321.

• --start-test=<prefix>

Start executing tests that begin with prefix.

• --suite=<name>

Execute the named test suite. Use this option multiple times to specify multiple suites.

• --testdir=<path>

The path to the test directory.

• --utildir=<path>

The location of the utilities.

• --verbose, -v

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug. To diagnose testexecution problems, use -vvv to display the actual results of test cases and ignore result processing.

• --version

Display version information and exit.

Page 226: MySQL Workbench

mysqldbcompare - Compare Two Databases and Identify Differences

218

• --width=<number>

Specify the display width. The default is 75 characters.

NOTES

The connection specifier must name a valid account for the server.

Any test named ???_template.py is skipped. This enables the developer to create a base class to importfor a collection of tests based on a common code base.

EXAMPLES

The following example demonstrates how to invoke mut to execute a subset of the tests using an existingserver which is cloned. The example displays the test name, status, and relative time:

$ python mut --server=root@localhost --do-tests=clone_user --width=70

MySQL Utilities Testing - MUT

Parameters used: Display Width = 70 Sorted = True Force = False Test directory = './t' Utilities directory = '../scripts' Starting port = 3310 Test wildcard = 'clone_user%'

Servers: Connecting to localhost as user root on port 3306: CONNECTED

----------------------------------------------------------------------TEST NAME STATUS TIME======================================================================main.clone_user [pass] 54main.clone_user_errors [pass] 27main.clone_user_parameters [pass] 17----------------------------------------------------------------------Testing completed: Friday 03 December 2010 09:50:06

All 3 tests passed.

mysqldbcompare - Compare Two Databases and Identify Differences

SYNOPSIS

mysqldbcompare [options] db1[:db2] ...

DESCRIPTION

This utility compares the objects and data from two databases to find differences. It identifies objectshaving different definitions in the two databases and presents them in a diff-style format of choice.Differences in the data are shown using a similar diff-style format. Changed or missing rows are shown in astandard format of GRID, CSV, TAB, or VERTICAL.

Use the notation db1:db2 to name two databases to compare, or, alternatively just db1 to compare twodatabases with the same name. The latter case is a convenience notation for comparing same-nameddatabases on different servers.

Page 227: MySQL Workbench

mysqldbcompare - Compare Two Databases and Identify Differences

219

The comparison may be run against two databases of different names on a single server by specifying onlythe --server1 option. The user can also connect to another server by specifying the --server2 option.In this case, db1 is taken from server1 and db2 from server2.

Those objects considered in the database include tables, views, triggers, procedures, functions, andevents. A count for each object type can be shown with the -vv option.

The check is performed using a series of steps called tests. By default, the utility stops on the first failedtest, but you can specify the --run-all-tests option to cause the utility to run all tests regardless oftheir end state.

Note: Using --run-all-tests may produce expected cascade failures. For example, if the row countsdiffer among two tables being compared, the data consistency will also fail.

The tests include the following:

1. Check database definitions

A database existence precondition check ensures that both databases exist. If they do not, no furtherprocessing is possible and the --run-all-tests option is ignored.

2. Check existence of objects in both databases

The test for objects in both databases identifies those objects missing from one or another database.The remaining tests apply only to those objects that appear in both databases. To skip this test, use the--skip-object-compare option. That can be useful when there are known missing objects amongthe databases.

3. Compare object definitions

The definitions (the CREATE statements) are compared and differences are presented. To skip thistest, use the --skip-diff option. That can be useful when there are object name differences onlythat you want to ignore.

4. Check table row counts

This check ensures that both tables have the same number of rows. This does not ensure that the tabledata is consistent. It is merely a cursory check to indicate possible missing rows in one table or theother. The data consistency check identifies the missing rows. To skip this test, use the --skip-row-count option.

5. Check table data consistency

This check identifies both changed rows as well as missing rows from one or another of the tables inthe databases. Changed rows are displayed as a diff-style report with the format chosen (GRID bydefault) and missing rows are also displayed using the format chosen. To skip this test, use the --skip-data-check option.

You may want to use the --skip-xxx options to run only one of the tests. This might be helpful whenworking to bring two databases into synchronization, to avoid running all of the tests repeatedly during theprocess.

Each test completes with one of the following states:

• pass

The test succeeded.

Page 228: MySQL Workbench

mysqldbcompare - Compare Two Databases and Identify Differences

220

• FAIL

The test failed. Errors are displayed following the test state line.

• SKIP

The test was skipped due to a missing prerequisite or a skip option.

• WARN

The test encountered an unusual but not fatal error.

• -

The test is not applicable to this object.

To specify how to display diff-style output, use one of the following values with the --difftype option:

• unified (default)

Display unified format output.

• context

Display context format output.

• differ

Display differ-style format output.

• sql

Display SQL transformation statement output.

To specify how to display output for changed or missing rows, use one of the following values with the --format option:

• grid (default)

Display output in grid or table format like that of the mysql monitor.

• csv

Display output in comma-separated values format.

• tab

Display output in tab-separated format.

• vertical

Display output in single-column format like that of the \G command for the mysql monitor.

The --changes-for option controls the direction of the difference (by specifying the object to betransformed) in either the difference report (default) or the transformation report (designated with the --difftype=sql option). Consider the following command:

mysqldbcompare --server1=root@host1 --server2=root@host2 --difftype=sql \ db1:dbx

Page 229: MySQL Workbench

mysqldbcompare - Compare Two Databases and Identify Differences

221

The leftmost database (db1) exists on the server designated by the --server1 option (host1). Therightmost database (dbx) exists on the server designated by the --server2 option (host2).

• --changes-for=server1: Produce output that shows how to make the definitions of objects onserver1 like the definitions of the corresponding objects on server2.

• --changes-for=server2: Produce output that shows how to make the definitions of objects onserver2 like the definitions of the corresponding objects on server1.

The default direction is server1.

You must provide connection parameters (user, host, password, and so forth) for an account that has theappropriate privileges to access all objects in the operation.

If the utility is to be run on a server that has binary logging enabled, and you do not want the comparisonsteps logged, use the --disable-binary-logging option.

OPTIONS

mysqldbcompare accepts the following command-line options:

• --help

Display a help message and exit.

• --changes-for=<direction>

Specify the server to show transformations to match the other server. For example, to see thetransformation for transforming object definitions on server1 to match the corresponding definitions onserver2, use --changes-for=server1. Permitted values are server1 and server2. The default isserver1.

• --difftype=<difftype>, -d<difftype>

Specify the difference display format. Permitted format values are unified, context, differ, and sql. Thedefault is unified.

• --disable-binary-logging

If binary logging is enabled, disable it during the operation to prevent comparison operations from beingwritten to the binary log. Note: Disabling binary logging requires the SUPER privilege.

• --format=<format>, -f<format>

Specify the display format for changed or missing rows. Permitted format values are grid, csv, tab, andvertical. The default is grid.

• --quiet, -q

Do not print anything. Return only an exit code of success or failure.

• --run-all-tests, -a

Do not halt at the first difference found. Process all objects.

• --server1=<source>

Connection information for the first server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

• --server2=<source>

Page 230: MySQL Workbench

mysqldbcompare - Compare Two Databases and Identify Differences

222

Connection information for the second server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

• --show-reverse

Produce a transformation report containing the SQL statements to conform the object definitionsspecified in reverse. For example, if –changes-for is set to server1, also generate the transformation forserver2. Note: The reverse changes are annotated and marked as comments.

• --skip-data-check

Skip the data consistency check.

• --skip-diff

Skip the object definition difference check.

• --skip-object-compare

Skip the object comparison check.

• --skip-row-count

Skip the row count check.

• --verbose, -v

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug.

• --version

Display version information and exit.

• --width=<number>

Change the display width of the test report. The default is 75 characters.

NOTES

The login user must have the appropriate permissions to read all databases and tables listed.

For the --difftype option, the permitted values are not case sensitive. In addition, values may bespecified as any unambiguous prefix of a valid value. For example, --difftype=d specifies the differtype. An error occurs if a prefix matches more than one valid value.

EXAMPLES

Use the following command to compare the emp1 and emp2 databases on the local server, and run alltests even if earlier tests fail:

$ mysqldbcompare --server1=root@localhost emp1:emp2 --run-all-tests# server1 on localhost: ... connected.# Checking databases emp1 on server1 and emp2 on server2

WARNING: Objects in server2:emp2 but not in server1:emp1: TRIGGER: trgPROCEDURE: p1 TABLE: t1 VIEW: v1

Page 231: MySQL Workbench

mysqldbcompare - Compare Two Databases and Identify Differences

223

Defn Row DataType Object Name Diff Count Check---------------------------------------------------------------------------FUNCTION f1 pass - -TABLE departments pass pass FAIL

Data differences found among rows:--- emp1.departments+++ emp2.departments@@ -1,4 +1,4 @@ ************************* 1. row ************************* dept_no: d002- dept_name: dunno+ dept_name: Finance 1 rows.

Rows in emp1.departments not in emp2.departments************************* 1. row ************************* dept_no: d008 dept_name: Research1 rows.

Rows in emp2.departments not in emp1.departments************************* 1. row ************************* dept_no: d100 dept_name: stupid1 rows.

TABLE dept_manager pass pass pass

Database consistency check failed.

# ...done

Given: two databases with the same table layout. Data for each table contains:

mysql> select * from db1.t1;+---+---------------+| a | b |+---+---------------+| 1 | Test 789 || 2 | Test 456 || 3 | Test 123 || 4 | New row - db1 |+---+---------------+4 rows in set (0.00 sec)

mysql> select * from db2.t1;+---+---------------+| a | b |+---+---------------+| 1 | Test 123 || 2 | Test 456 || 3 | Test 789 || 5 | New row - db2 |+---+---------------+4 rows in set (0.00 sec)

To generate the SQL statements for data transformations to make db1.t1 the same as db2.t1, usethe --changes-for=server1 option. We must also include the -a option to ensure that the dataconsistency test is run. The following command illustrates the options used and an excerpt from the resultsgenerated:

$ mysqldbcompare --server1=root:root@localhost \ --server2=root:root@localhost db1:db2 --changes-for=server1 -a \ --difftype=sql

Page 232: MySQL Workbench

mysqldbcompare - Compare Two Databases and Identify Differences

224

[...]

# Defn Row Data# Type Object Name Diff CountCheck #-------------------------------------------------------------------------# TABLE t1 pass pass FAIL# # Data transformations for direction = server1:

# Data differences found among rows: UPDATE db1.t1 SET b = 'Test 123'WHERE a = '1'; UPDATE db1.t1 SET b = 'Test 789' WHERE a = '3'; DELETEFROM db1.t1 WHERE a = '4'; INSERT INTO db1.t1 (a, b) VALUES('5', 'Newrow - db2');

# Database consistency check failed. # # ...done

Similarly, when the same command is run with --changes-for=server2 and --difftype=sql, thefollowing report is generated:

$ mysqldbcompare --server1=root:root@localhost \ --server2=root:root@localhost db1:db2 --changes-for=server2 -a \ --difftype=sql

[...]

# Defn Row Data# Type Object Name Diff CountCheck #-------------------------------------------------------------------------# TABLE t1 pass pass FAIL# # Data transformations for direction = server2:

# Data differences found among rows: UPDATE db2.t1 SET b = 'Test 789'WHERE a = '1'; UPDATE db2.t1 SET b = 'Test 123' WHERE a = '3'; DELETEFROM db2.t1 WHERE a = '5'; INSERT INTO db2.t1 (a, b) VALUES('4', 'Newrow - db1');

With the --difftype=sql SQL generation option set, --show-reverse shows the objecttransformations in both directions. Here is an excerpt of the results:

$ mysqldbcompare --server1=root:root@localhost \ --server2=root:root@localhost db1:db2 --changes-for=server1 \--show-reverse -a --difftype=sql

[...]

# Defn Row Data# Type Object Name Diff CountCheck #-------------------------------------------------------------------------# TABLE t1 pass pass FAIL# # Data transformations for direction = server1:

# Data differences found among rows: UPDATE db1.t1 SET b = 'Test 123'WHERE a = '1'; UPDATE db1.t1 SET b = 'Test 789' WHERE a = '3'; DELETEFROM db1.t1 WHERE a = '4'; INSERT INTO db1.t1 (a, b) VALUES('5', 'Newrow - db2');

# Data transformations for direction = server2:

# Data differences found among rows: UPDATE db2.t1 SET b = 'Test 789'WHERE a = '1'; UPDATE db2.t1 SET b = 'Test 123' WHERE a = '3'; DELETEFROM db2.t1 WHERE a = '5'; INSERT INTO db2.t1 (a, b) VALUES('4', 'Newrow - db1');

Page 233: MySQL Workbench

mysqldbcopy - Copy Database Objects Between Servers

225

# Database consistency check failed. # # ...done

mysqldbcopy - Copy Database Objects Between Servers

SYNOPSIS

mysqldbcopy [options] db_name[:new_db_name]

DESCRIPTION

This utility copies a database on a source server to a database on a destination server. If the source anddestination servers are different, the database names can be the same or different. If the source anddestination servers are the same, the database names must be different.

The utility accepts one or more database pairs on the command line. To name a database pair, usedb_name:new_db_name syntax to specify the source and destination names explicitly. If the source anddestination database names are the same, db_name can be used as shorthand for db_name:db_name.

By default, the operation copies all objects (tables, views, triggers, events, procedures, functions, anddatabase-level grants) and data to the destination server. There are options to turn off copying any or all ofthe objects as well as not copying the data.

To exclude specific objects by name, use the --exclude option with a name in db.*obj* format, or youcan supply a search pattern. For example, --exclude=db1.trig1 excludes the single trigger and --exclude=trig_ excludes all objects from all databases having a name that begins with trig and has afollowing character.

By default, the utility creates each table on the destination server using the same storage engine asthe original table. To override this and specify the storage engine to use for all tables created on thedestination server, use the --new-storage-engine option. If the destination server supports the newengine, all tables use that engine.

To specify the storage engine to use for tables for which the destination server does not support theoriginal storage engine on the source server, use the --default-storage-engine option.

The --new-storage-engine option takes precedence over --default-storage-engine if both aregiven.

If the --new-storage-engine or --default-storage-engine option is given and the destinationserver does not support the specified storage engine, a warning is issued and the server’s default storageengine setting is used instead.

By default, the operation uses a consistent snapshot to read the source databases. To change the lockingmode, use the --locking option with a locking type value. Use a value of no-locks to turn off lockingaltogether or lock-all to use only table locks. The default value is snapshot. Additionally, the utility usesWRITE locks to lock the destination tables during the copy.

You can include replication statements for copying data among a master and slave or between slaves. The--rpl option permits you to select from the following replication statements to include in the export.

• master

Include the CHANGE MASTER statement to start a new slave with the current server acting asthe master. This executes the appropriate STOP and START slave statements. The STOP SLAVEstatement is executed at the start of the copy and the CHANGE MASTER followed by the STARTSLAVE statements are executed after the copy.

Page 234: MySQL Workbench

mysqldbcopy - Copy Database Objects Between Servers

226

• slave

Include the CHANGE MASTER statement to start a new slave using the current server’s masterinformation. This executes the appropriate STOP and START slave statements. The STOP SLAVEstatement is executed at the start of the copy and the CHANGE MASTER followed by the STARTSLAVE statements follow the copy.

To include the replication user in the CHANGE MASTER statement, use the --rpl-user option tospecify the user and password. If this option is omitted, the utility attempts to identify the replication user. Inthe event that there are multiple candidates or the user requires a password, the utility aborts with an error.

OPTIONS

mysqldbcopy accepts the following command-line options:

• --help

Display a help message and exit.

• --default-storage-engine=<def_engine>

The engine to use for tables if the destination server does not support the original storage engine on thesource server.

• --destination=<destination>

Connection information for the destination server in <user>[:<passwd>]@<host>[:<port>][:<socket>]format, where <passwd> is optional and either <port> or <socket> must be provided.

• --exclude=<exclude>, -x<exclude>

Exclude one or more objects from the operation using either a specific name such as db1.t1 or a searchpattern. Use this option multiple times to specify multiple exclusions. By default, patterns use LIKEmatching. With the --regexp option, patterns use REGEXP matching.

This option does not apply to grants.

• --force

Drop each database to be copied if exists before copying anything into it. Without this option, an erroroccurs if you attempt to copy objects into an existing database.

• --locking=<locking>

Choose the lock type for the operation. Permitted lock values are no-locks (do not use any table locks),lock-all (use table locks but no transaction and no consistent read), and snaphot (consistent read usinga single transaction). The default is snapshot.

• --new-storage-engine=<new_engine>

The engine to use for all tables created on the destination server.

• --quiet, -q

Turn off all messages for quiet execution.

• --regexp, --basic-regexp, -G

Perform pattern matches using the REGEXP operator. The default is to use LIKE for matching.

Page 235: MySQL Workbench

mysqldbcopy - Copy Database Objects Between Servers

227

• --rpl=<dump_option>, --replication=<dump_option>

Include replication information. Permitted values are master (include the CHANGE MASTER statementusing the source server as the master), slave (include the CHANGE MASTER statement using thedestination server’s master information), and both (include the master and slave options whereapplicable).

• --rpl-user=<user[:password]>

The user and password for the replication user requirement - e.g. rpl:passwd - default = rpl:rpl.

• --skip=<objects>

Specify objects to skip in the operation as a comma-separated list (no spaces). Permitted values areCREATE_DB, DATA, EVENTS, FUNCTIONS, GRANTS, PROCEDURES, TABLES, TRIGGERS, andVIEWS.

• --source=<source>

Connection information for the source server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format,where <passwd> is optional and either <port> or <socket> must be provided.

• --threads

Use multiple threads for cross-server copy. The default is 1.

• --verbose, -v

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug.

• --version

Display version information and exit.

NOTES

You must provide connection parameters (user, host, password, and so forth) for an account that has theappropriate privileges to access all objects in the operation.

To copy all objects from a source, the user must have these privileges: SELECT and SHOW VIEW for thedatabase, and SELECT for the mysql database.

To copy all objects to a destination, the user must have these privileges: CREATE for the database,SUPER (when binary logging is enabled) for procedures and functions, and GRANT OPTION to copygrants.

Actual privileges required may differ from installation to installation depending on the security privilegespresent and whether the database contains certain objects such as views or events and whether binarylogging is enabled.

The --new-storage-engine and --default-storage-engine options apply to all destination tablesin the operation.

Some option combinations may result in errors during the operation. For example, eliminating tables butnot views may result in an error a the view is copied.

The --rpl option is not valid for copying databases on the same server. An error will be generated.

Page 236: MySQL Workbench

mysqldbcopy - Copy Database Objects Between Servers

228

EXAMPLES

The following example demonstrates how to use the utility to copy a database named util_test to anew database named util_test_copy on the same server:

$ mysqldbcopy \ --source=root:pass@localhost:3310:/test123/mysql.sock \ --destination=root:pass@localhost:3310:/test123/mysql.sock \ util_test:util_test_copy# Source on localhost: ... connected.# Destination on localhost: ... connected.# Copying database util_test renamed as util_test_copy# Copying TABLE util_test.t1# Copying table data.# Copying TABLE util_test.t2# Copying table data.# Copying TABLE util_test.t3# Copying table data.# Copying TABLE util_test.t4# Copying table data.# Copying VIEW util_test.v1# Copying TRIGGER util_test.trg# Copying PROCEDURE util_test.p1# Copying FUNCTION util_test.f1# Copying EVENT util_test.e1# Copying GRANTS from util_test#...done.

If the database to be copied does not contain only InnoDB tables and you want to ensure data integrityof the copied data by locking the tables during the read step, add a --locking=lock-all option to thecommand:

$ mysqldbcopy \ --source=root:pass@localhost:3310:/test123/mysql.sock \ --destination=root:pass@localhost:3310:/test123/mysql.sock \ util_test:util_test_copy --locking=lock-all# Source on localhost: ... connected.# Destination on localhost: ... connected.# Copying database util_test renamed as util_test_copy# Copying TABLE util_test.t1# Copying table data.# Copying TABLE util_test.t2# Copying table data.# Copying TABLE util_test.t3# Copying table data.# Copying TABLE util_test.t4# Copying table data.# Copying VIEW util_test.v1# Copying TRIGGER util_test.trg# Copying PROCEDURE util_test.p1# Copying FUNCTION util_test.f1# Copying EVENT util_test.e1# Copying GRANTS from util_test#...done.

To copy one or more databases from a master to a slave, you can use the following command to copy thedatabases. Use the master as the source and the slave as the destination:

$ mysqldbcopy --source=root@localhost:3310 \ --destination=root@localhost:3311 test123 --rpl=master \ --rpl-user=rpl# Source on localhost: ... connected.# Destination on localhost: ... connected.# Source on localhost: ... connected.# Stopping slave

Page 237: MySQL Workbench

mysqldbexport - Export Object Definitions or Data from a Database

229

# Copying database test123# Copying TABLE test123.t1# Copying data for TABLE test123.t1# Connecting to the current server as master# Starting slave#...done.

To copy a database from one slave to another attached to the same master, you can use the followingcommand using the slave with the database to be copied as the source and the slave where the databaseneeds to copied to as the destination:

$ mysqldbcopy --source=root@localhost:3311 \ --destination=root@localhost:3312 test123 --rpl=slave \ --rpl-user=rpl# Source on localhost: ... connected.# Destination on localhost: ... connected.# Source on localhost: ... connected.# Stopping slave# Copying database test123# Copying TABLE test123.t1# Copying data for TABLE test123.t1# Connecting to the current server's master# Starting slave#...done.

mysqldbexport - Export Object Definitions or Data from a Database

SYNOPSIS

mysqldbexport [options] db_name ...

DESCRIPTION

This utility exports metadata (object definitions) or data or both from one or more databases. By default,the export includes only definitions.

mysqldbexport differs from mysqldump in that it can produce output in a variety of formats to make yourdata extraction/transport much easier. It permits you to export your data in the format most suitable to anexternal tool, another MySQL server, or other use without the need to reformat the data.

To exclude specific objects by name, use the --exclude option with a name in db.*obj* format, or youcan supply a search pattern. For example, --exclude=db1.trig1 excludes the single trigger and --exclude=trig_ excludes all objects from all databases having a name that begins with trig and has afollowing character.

To skip objects by type, use the --skip option with a list of the objects to skip. This enables you to extracta particular set of objects, say, for exporting only events (by excluding all other types). Similarly, to skipcreation of UPDATE statements for BLOB data, specify the --skip-blobs option.

To specify how to display output, use one of the following values with the --format option:

• sql (default)

Display output using SQL statements. For definitions, this consists of the appropriate CREATE andGRANT statements. For data, this is an INSERT statement (or bulk insert if the --bulk-insert optionis specified).

• grid

Display output in grid or table format like that of the mysql monitor.

Page 238: MySQL Workbench

mysqldbexport - Export Object Definitions or Data from a Database

230

• csv

Display output in comma-separated values format.

• tab

Display output in tab-separated format.

• vertical

Display output in single-column format like that of the \G command for the mysql monitor.

To specify how much data to display, use one of the following values with the --display option:

• brief

Display only the minimal columns for recreating the objects.

• full

Display the complete column list for recreating the objects.

• names

Display only the object names.

Note: For SQL-format output, the --display option is ignored.

To turn off the headers for csv or tab display format, specify the --no-headers option.

To turn off all feedback information, specify the --quiet option.

To write the data for individual tables to separate files, use the --file-per-table option. The nameof each file is composed of the database and table names followed by the file format. For example, thefollowing command produces files named db1.*table_name*.csv:

mysqldbexport --server=root@server1:3306 --format=csv db1 --export=data

By default, the operation uses a consistent snapshot to read the source databases. To change the lockingmode, use the --locking option with a locking type value. Use a value of no-locks to turn off lockingaltogether or lock-all to use only table locks. The default value is snapshot. Additionally, the utility usesWRITE locks to lock the destination tables during the copy.

You can include replication statements for exporting data among a master and slave or between slaves.The --rpl option permits you to select from the following replication statements to include in the export.

• master

Include the CHANGE MASTER statement to start a new slave with the current server acting as themaster. This places the appropriate STOP and START slave statements in the export whereby theSTOP SLAVE statement is placed at the start of the export and the CHANGE MASTER followed by theSTART SLAVE statements are placed after the export stream.

• slave

Include the CHANGE MASTER statement to start a new slave using the current server’s masterinformation. This places the appropriate STOP and START slave statements in the export whereby theSTOP SLAVE statment is placed at the start of the export and the CHANGE MASTER followed by theSTART SLAVE statements are placed after the export stream.

Page 239: MySQL Workbench

mysqldbexport - Export Object Definitions or Data from a Database

231

• both

Include both the ‘master’ and ‘slave’ information for CHANGE MASTER statements for either spawninga new slave with the current server’s master or using the current server as the master. All statementsgenerated are labeled and commented to enable the user to choose which to include when imported.

To include the replication user in the CHANGE MASTER statement, use the --rpl-user option tospecify the user and password. If this option is omitted, the utility attempts to identify the replication user. Inthe event that there are multiple candidates or the user requires a password, these statements are placedinside comments for the CHANGE MASTER statement.

You can also use the --comment-rpl option to place the replication statements inside comments for laterexamination.

If you specify the --rpl-file option, the utility writes the replication statements to the file specifiedinstead of including them in the export stream.

OPTIONS

mysqldbexport accepts the following command-line options:

• --help

Display a help message and exit.

• --bulk-insert, -b

Use bulk insert statements for data.

• --comment-rpl

Place the replication statements in comment statements. Valid only with the --rpl option.

• --display=<display>, -d<display>

Control the number of columns shown. Permitted display values are brief (minimal columns for objectcreation), full* (all columns), and **names (only object names; not valid for --format=sql). Thedefault is brief.

• --exclude=<exclude>, -x<exclude>

Exclude one or more objects from the operation using either a specific name such as db1.t1 or asearch pattern. Use this option multiple times to specify multiple exclusions. By default, patterns useLIKE matching. With the --regexp option, patterns use REGEXP matching.

This option does not apply to grants.

• --export=<export>, -e<export>

Specify the export format. Permitted format values are definitions = export only the definitions(metadata) for the objects in the database list, data = export only the table data for the tables in thedatabase list, and both = export the definitions and the data. The default is definitions.

• --file-per-table

Write table data to separate files. This is Valid only if the export output includes data (thatis, if --export=data or --export=both are given). This option produces files nameddb_name.*tbl_name*.*format*. For example, a csv export of two tables named t1 and t2 in database

Page 240: MySQL Workbench

mysqldbexport - Export Object Definitions or Data from a Database

232

d1, results in files named db1.t1.csv and db1.t2.csv. If table definitions are included in the export,they are written to stdout as usual.

• --format=<format>, -f<format>

Specify the output display format. Permitted format values are sql, grid, tab, csv, and vertical. Thedefault is sql.

• --locking=<locking>

Choose the lock type for the operation. Permitted lock values are no-locks (do not use any table locks),lock-all (use table locks but no transaction and no consistent read), and snapshot (consistent readusing a single transaction). The default is snapshot.

• --no-headers, -h

Do not display column headers. This option applies only for csv and tab output.

• --quiet, -q

Turn off all messages for quiet execution.

• --regexp, --basic-regexp, -G

Perform pattern matches using the REGEXP operator. The default is to use LIKE for matching.

• --rpl=<dump_option>, --replication=<dump_option>

Include replication information. Permitted values are master (include the CHANGE MASTER statementusing the source server as the master), slave (include the CHANGE MASTER statement using thedestination server’s master information), and both (include the master and slave options whereapplicable).

• --rpl-file=RPL_FILE, --replication-file=RPL_FILE

The path and file name where the generated replication information should be written. Valid only with the--rpl option.

• --rpl-user=<user[:password]>

The user and password for the replication user requirement; for example, rpl:passwd. The default isrpl:rpl.

• --server=<server>

Connection information for the server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

• --skip=<skip-objects>

Specify objects to skip in the operation as a comma-separated list (no spaces). Permitted values areCREATE_DB, DATA, EVENTS, FUNCTIONS, GRANTS, PROCEDURES, TABLES, TRIGGERS, andVIEWS.

• --skip-blobs

Do not export BLOB data.

• --verbose, -v

Page 241: MySQL Workbench

mysqldbexport - Export Object Definitions or Data from a Database

233

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug.

• --version

Display version information and exit.

NOTES

You must provide connection parameters (user, host, password, and so forth) for an account that has theappropriate privileges to access all objects in the operation.

To export all objects from a source database, the user must have these privileges: SELECT and SHOWVIEW on the database as well as SELECT on the mysql database.

Actual privileges needed may differ from installation to installation depending on the security privilegespresent and whether the database contains certain objects such as views or events.

Some combinations of the options may result in errors when the export is imported later. For example,eliminating tables but not views may result in an error when a view is imported on another server.

For the --format, --export, and --display options, the permitted values are not case sensitive. Inaddition, values may be specified as any unambiguous prefix of a valid value. For example, --format=gspecifies the grid format. An error occurs if a prefix matches more than one valid value.

EXAMPLES

To export the definitions of the database dev from a MySQL server on the local host via port 3306,producing output consisting of CREATE statements, use this command:

$ mysqldbexport --server=root:pass@localhost \ --skip=GRANTS --export=DEFINITIONS util_test# Source on localhost: ... connected.# Exporting metadata from util_testDROP DATABASE IF EXISTS util_test;CREATE DATABASE util_test;USE util_test;# TABLE: util_test.t1CREATE TABLE `t1` ( `a` char(30) DEFAULT NULL) ENGINE=MEMORY DEFAULT CHARSET=latin1;# TABLE: util_test.t2CREATE TABLE `t2` ( `a` char(30) DEFAULT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;# TABLE: util_test.t3CREATE TABLE `t3` ( `a` int(11) NOT NULL AUTO_INCREMENT, `b` char(30) DEFAULT NULL, PRIMARY KEY (`a`)) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;# TABLE: util_test.t4CREATE TABLE `t4` ( `c` int(11) NOT NULL, `d` int(11) NOT NULL, KEY `ref_t3` (`c`), CONSTRAINT `ref_t3` FOREIGN KEY (`c`) REFERENCES `t3` (`a`)) ENGINE=InnoDB DEFAULT CHARSET=latin1;# VIEW: util_test.v1[...]#...done.

Page 242: MySQL Workbench

mysqldbexport - Export Object Definitions or Data from a Database

234

Similarly, to export the data of the database util_test, producing bulk insert statements, use thiscommand:

$ mysqldbexport --server=root:pass@localhost \ --export=DATA --bulk-insert util_test# Source on localhost: ... connected.USE util_test;# Exporting data from util_test# Data for table util_test.t1:INSERT INTO util_test.t1 VALUES ('01 Test Basic database example'), ('02 Test Basic database example'), ('03 Test Basic database example'), ('04 Test Basic database example'), ('05 Test Basic database example'), ('06 Test Basic database example'), ('07 Test Basic database example');# Data for table util_test.t2:INSERT INTO util_test.t2 VALUES ('11 Test Basic database example'), ('12 Test Basic database example'), ('13 Test Basic database example');# Data for table util_test.t3:INSERT INTO util_test.t3 VALUES (1, '14 test fkeys'), (2, '15 test fkeys'), (3, '16 test fkeys');# Data for table util_test.t4:INSERT INTO util_test.t4 VALUES (3, 2);#...done.

If the database to be exported does not contain only InnoDB tables and you want to ensure data integrityof the exported data by locking the tables during the read step, add a --locking=lock-all option to thecommand:

$ mysqldbexport --server=root:pass@localhost \ --export=DATA --bulk-insert util_test --locking=lock-all# Source on localhost: ... connected.USE util_test;# Exporting data from util_test# Data for table util_test.t1:INSERT INTO util_test.t1 VALUES ('01 Test Basic database example'), ('02 Test Basic database example'), ('03 Test Basic database example'), ('04 Test Basic database example'), ('05 Test Basic database example'), ('06 Test Basic database example'), ('07 Test Basic database example');# Data for table util_test.t2:INSERT INTO util_test.t2 VALUES ('11 Test Basic database example'), ('12 Test Basic database example'), ('13 Test Basic database example');# Data for table util_test.t3:INSERT INTO util_test.t3 VALUES (1, '14 test fkeys'), (2, '15 test fkeys'), (3, '16 test fkeys');# Data for table util_test.t4:INSERT INTO util_test.t4 VALUES (3, 2);#...done.

To export a database and include the replication commands to use the current server as the master (forexample, to start a new slave using the current server as the master), use the following command:

$ mysqldbexport --server=root@localhost:3311 util_test \ --export=both --rpl-user=rpl:rpl --rpl=master -v# Source on localhost: ... connected.## Stopping slaveSTOP SLAVE;

Page 243: MySQL Workbench

mysqldbexport - Export Object Definitions or Data from a Database

235

## Source on localhost: ... connected.# Exporting metadata from util_testDROP DATABASE IF EXISTS util_test;CREATE DATABASE util_test;USE util_test;# TABLE: util_test.t1CREATE TABLE `t1` ( `a` char(30) DEFAULT NULL) ENGINE=MEMORY DEFAULT CHARSET=latin1;#...done.# Source on localhost: ... connected.USE util_test;# Exporting data from util_test# Data for table util_test.t1:INSERT INTO util_test.t1 VALUES ('01 Test Basic database example');INSERT INTO util_test.t1 VALUES ('02 Test Basic database example');INSERT INTO util_test.t1 VALUES ('03 Test Basic database example');INSERT INTO util_test.t1 VALUES ('04 Test Basic database example');INSERT INTO util_test.t1 VALUES ('05 Test Basic database example');INSERT INTO util_test.t1 VALUES ('06 Test Basic database example');INSERT INTO util_test.t1 VALUES ('07 Test Basic database example');#...done.## Connecting to the current server as masterCHANGE MASTER TO MASTER_HOST = 'localhost', MASTER_USER = 'rpl', MASTER_PASSWORD = 'rpl', MASTER_PORT = 3311, MASTER_LOG_FILE = 'clone-bin.000001' , MASTER_LOG_POS = 106;## Starting slaveSTART SLAVE;#

Similarly, to export a database and include the replication commands to use the current server’s master(for example, to start a new slave using the same the master), use the following command:

$ mysqldbexport --server=root@localhost:3311 util_test \ --export=both --rpl-user=rpl:rpl --rpl=slave -v# Source on localhost: ... connected.## Stopping slaveSTOP SLAVE;## Source on localhost: ... connected.# Exporting metadata from util_testDROP DATABASE IF EXISTS util_test;CREATE DATABASE util_test;USE util_test;# TABLE: util_test.t1CREATE TABLE `t1` ( `a` char(30) DEFAULT NULL) ENGINE=MEMORY DEFAULT CHARSET=latin1;#...done.# Source on localhost: ... connected.USE util_test;# Exporting data from util_test# Data for table util_test.t1:INSERT INTO util_test.t1 VALUES ('01 Test Basic database example');INSERT INTO util_test.t1 VALUES ('02 Test Basic database example');INSERT INTO util_test.t1 VALUES ('03 Test Basic database example');INSERT INTO util_test.t1 VALUES ('04 Test Basic database example');INSERT INTO util_test.t1 VALUES ('05 Test Basic database example');INSERT INTO util_test.t1 VALUES ('06 Test Basic database example');INSERT INTO util_test.t1 VALUES ('07 Test Basic database example');

Page 244: MySQL Workbench

mysqldbimport - Import Object Definitions or Data into a Database

236

#...done.## Connecting to the current server's masterCHANGE MASTER TO MASTER_HOST = 'localhost', MASTER_USER = 'rpl', MASTER_PASSWORD = 'rpl', MASTER_PORT = 3310, MASTER_LOG_FILE = 'clone-bin.000001' , MASTER_LOG_POS = 1739;## Starting slaveSTART SLAVE;#

mysqldbimport - Import Object Definitions or Data into a Database

SYNOPSIS

mysqldbimport [options] import_file ...

DESCRIPTION

This utility imports metadata (object definitions) or data or both for one or more databases from one ormore files.

If an object exists on the destination server with the same name as an imported object, it is dropped firstbefore importing the new object.

To skip objects by type, use the --skip option with a list of the objects to skip. This enables you to extracta particular set of objects, say, for importing only events (by excluding all other types). Similarly, to skipcreation of UPDATE statements for BLOB data, specify the --skip-blobs option.

To specify the input format, use one of the following values with the --format option. These correspondto the output formats of the mysqldbexport utility:

• sql (default)

Input consists of SQL statements. For definitions, this consists of the appropriate CREATE and GRANTstatements. For data, this is an INSERT statement (or bulk insert if the --bulk-insert option isspecified).

• grid

Display output in grid or table format like that of the mysql monitor.

• csv

Input is formatted in comma-separated values format.

• tab

Input is formatted in tab-separated format.

• vertical

Display output in single-column format like that of the \G command for the mysql monitor.

To indicate that input in csv or tab format does not contain column headers, specify the --no-headersoption.

Page 245: MySQL Workbench

mysqldbimport - Import Object Definitions or Data into a Database

237

To turn off all feedback information, specify the --quiet option.

By default, the utility creates each table on the destination server using the same storage engine asthe original table. To override this and specify the storage engine to use for all tables created on thedestination server, use the --new-storage-engine option. If the destination server supports the newengine, all tables use that engine.

To specify the storage engine to use for tables for which the destination server does not support theoriginal storage engine on the source server, use the --default-storage-engine option.

The --new-storage-engine option takes precedence over --default-storage-engine if both aregiven.

If the --new-storage-engine or --default-storage-engine option is given and the destinationserver does not support the specified storage engine, a warning is issued and the server’s default storageengine setting is used instead.

You must provide connection parameters (user, host, password, and so forth) for an account that has theappropriate privileges to access all objects in the operation. For details, see NOTES.

OPTIONS

mysqldbimport accepts the following command-line options:

• --help

Display a help message and exit.

• --bulk-insert, -b

Use bulk insert statements for data.

• --default-storage-engine=<def_engine>

The engine to use for tables if the destination server does not support the original storage engine on thesource server.

• --drop-first, -d

Drop each database to be imported if exists before importing anything into it.

• --dryrun

Import the files and generate the statements but do not execute them. This is useful for testing input filevalidity.

• --format=<format>, -f<format>

Specify the input format. Permitted format values are sql, grid, tab, csv, and vertical. The default is sql.

• --import=<import_type>, -i<import_type>

Specify the import format. Permitted format values are definitions = import only the definitions(metadata) for the objects in the database list, data = import only the table data for the tables in thedatabase list, and both = import the definitions and the data. The default is definitions.

If you attempt to import objects into an existing database, the result depends on the import format. Ifthe format is definitions or both, an error occurs unless --drop-first is given. If the format is data,imported table data is added to existing table data.

Page 246: MySQL Workbench

mysqldbimport - Import Object Definitions or Data into a Database

238

• --new-storage-engine=<new_engine>

The engine to use for all tables created on the destination server.

• --no-headers, -h

Input does not contain column headers. This option applies only for csv and tab output.

• --quiet, -q

Turn off all messages for quiet execution.

• --server=<server>

Connection information for the server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

• --skip=<skip_objects>

Specify objects to skip in the operation as a comma-separated list (no spaces). Permitted values areCREATE_DB, DATA, EVENTS, FUNCTIONS, GRANTS, PROCEDURES, TABLES, TRIGGERS, andVIEWS.

• --skip-blobs

Do not import BLOB data.

• --skip-rpl

Do not execute replication commands.

• --verbose, -v

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug.

• --version

Display version information and exit.

NOTES

The login user must have the appropriate permissions to create new objects, access (read) the mysqldatabase, and grant privileges. If a database to be imported already exists, the user must have readpermission for it, which is needed to check the existence of objects in the database.

Actual privileges needed may differ from installation to installation depending on the security privilegespresent and whether the database contains certain objects such as views or events and whether binarylogging is enabled.

Some combinations of the options may result in errors during the operation. For example, excluding tablesbut not views may result in an error when a view is imported.

The --new-storage-engine and --default-storage-engine options apply to all destination tablesin the operation.

For the --format and --import options, the permitted values are not case sensitive. In addition, valuesmay be specified as any unambiguous prefix of a valid value. For example, --format=g specifies the gridformat. An error occurs if a prefix matches more than one valid value.

Page 247: MySQL Workbench

mysqldiff - Identify Differences Among Database Objects

239

EXAMPLES

To import the metadata from the util_test database to the server on the local host using a file in CSVformat, use this command:

$ mysqldbimport --server=root@localhost --import=definitions \ --format=csv data.csv# Source on localhost: ... connected.# Importing definitions from data.csv.#...done.

Similarly, to import the data from the util_test database to the server on the local host, importing thedata using bulk insert statements, use this command:

$ mysqldbimport --server=root@localhost --import=data \ --bulk-insert --format=csv data.csv# Source on localhost: ... connected.# Importing data from data.csv.#...done.

To import both data and definitions from the util_test database, importing the data using bulk insertstatements from a file that contains SQL statements, use this command:

$ mysqldbimport --server=root@localhost --import=both \ --bulk-insert --format=sql data.sql# Source on localhost: ... connected.# Importing definitions and data from data.sql.#...done.

mysqldiff - Identify Differences Among Database Objects

SYNOPSIS

mysqldiff [options] {db1[:db1] | db1.obj1[:db2.obj2]} ...

DESCRIPTION

This utility reads the definitions of objects and compares them using a diff-like method to determinewhether they are the same. The utility displays the differences for objects that are not the same.

Use the notation db1:db2 to name two databases to compare, or, alternatively just db1 to compare twodatabases with the same name. The latter case is a convenience notation for comparing same-nameddatabases on different servers.

The comparison may be run against two databases of different names on a single server by specifying onlythe --server1 option. The user can also connect to another server by specifying the --server2 option.In this case, db1 is taken from server1 and db2 from server2.

When a database pair is specified, all objects in one database are compared to the corresponding objectsin the other. Any objects not appearing in either database produce an error.

To compare a specific pair of objects, add an object name to each database name in db.obj format. Forexample, use db1.obj1:db2.obj2 to compare two named objects, or db1.obj1 to compare an objectwith the same name in databases with the same name. It is not legal to mix a database name with anobject name. For example, db1.obj1:db2 and db1:db2.obj2 are illegal.

The comparison may be run against a single server for comparing two databases of different names onthe same server by specifying only the --server1 option. Alternatively, you can also connect to anotherserver by specifying the --server2 option. In this case, the first object to compare is taken from server1and the second from server2.

Page 248: MySQL Workbench

mysqldiff - Identify Differences Among Database Objects

240

By default, the utilty generates object differences as a difference report. However, you can generatea transformation report containing SQL statements for transforming the objects for conformity instead.Use the ‘sql’ value for the --difftype option to produce a listing that contains the appropriate ALTERcommands to conform the object definitions for the object pairs specified. If a transformation cannot beformed, the utility reports the diff of the object along with a warning statement. See important limitations inthe NOTES section.

To specify how to display diff-style output, use one of the following values with the --difftype option:

• unified (default)

Display unified format output.

• context

Display context format output.

• differ

Display differ-style format output.

• sql

Display SQL transformation statement output.

The --changes-for option controls the direction of the difference (by specifying the object to betransformed) in either the difference report (default) or the transformation report (designated with the --difftype=sql option). Consider the following command:

mysqldiff --server1=root@host1 --server2=root@host2 --difftype=sql \ db1.table1:dbx.table3

The leftmost database (db1) exists on the server designated by the --server1 option (host1). Therightmost database (dbx) exists on the server designated by the --server2 option (host2).

• --changes-for=server1: Produce output that shows how to make the definitions of objects onserver1 like the definitions of the corresponding objects on server2.

• --changes-for=server2: Produce output that shows how to make the definitions of objects onserver2 like the definitions of the corresponding objects on server1.

The default direction is server1.

For sql difference format, you can also see the reverse transformation by specifying the --show-reverse option.

The utility stops on the first occurrence of missing objects or when an object does not match. To overridethis behavior, specify the --force option to cause the utility to attempt to compare all objects listed asarguments.

OPTIONS

mysqldiff accepts the following command-line options:

• --help

Display a help message and exit.

• --changes-for=<direction>

Page 249: MySQL Workbench

mysqldiff - Identify Differences Among Database Objects

241

Specify the server to show transformations to match the other server. For example, to see thetransformation for transforming object definitions on server1 to match the corresponding definitions onserver2, use --changes-for=server1. Permitted values are server1 and server2. The default isserver1.

• --difftype=<difftype>, -d<difftype>

Specify the difference display format. Permitted format values are unified, context, differ, and sql. Thedefault is unified.

• --force

Do not halt at the first difference found. Process all objects to find all differences.

• --quiet, -q

Do not print anything. Return only an exit code of success or failure.

• --server1=<source>

Connection information for the first server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

• --server2=<source>

Connection information for the second server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

• --show-reverse

Produce a transformation report containing the SQL statements to conform the object definitionsspecified in reverse. For example, if --changes-for is set to server1, also generate the transformationfor server2. Note: The reverse changes are annotated and marked as comments.

• --verbose, -v

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug.

• --version

Display version information and exit.

• --width=<number>

Change the display width of the test report. The default is 75 characters.

NOTES

You must provide connection parameters (user, host, password, and so forth) for an account that has theappropriate privileges to access all objects to be compared.

The SQL transformation feature has these known limitations:

• When tables with partition differences are encountered, the utility generates the ALTER TABLEstatement for all other changes but prints a warning and omits the partition differences.

• If the transformation detects table options in the source table (specified with the --changes-foroption) that are not changed or do not exist in the target table, the utility generates the ALTER TABLEstatement for all other changes but prints a warning and omits the table option differences.

Page 250: MySQL Workbench

mysqldiff - Identify Differences Among Database Objects

242

• Rename for events is not supported. This is because mysqldiff compares objects by name. In thiscase, depending on the direction of the diff, the event is identified as needing to be added or a DROPEVENT statement is generated.

• Changes in the definer clause for events are not supported.

• SQL extensions specific to MySQL Cluster are not supported.

For the --difftype option, the permitted values are not case sensitive. In addition, values may bespecified as any unambiguous prefix of a valid value. For example, --difftype=d specifies the differtype. An error occurs if a prefix matches more than one valid value.

EXAMPLES

To compare the employees and emp databases on the local server, use this command:

$ mysqldiff --server1=root@localhost employees:emp1# server1 on localhost: ... connected.WARNING: Objects in server1:employees but not in server2:emp1: EVENT: e1Compare failed. One or more differences found.

$ mysqldiff --server1=root@localhost \ employees.t1:emp1.t1 employees.t3:emp1.t3# server1 on localhost: ... connected.# Comparing employees.t1 to emp1.t1 [PASS]# server1 on localhost: ... connected.# Comparing employees.t3 to emp1.t3 [PASS]Success. All objects are the same.

$ mysqldiff --server1=root@localhost \ employees.salaries:emp1.salaries --differ# server1 on localhost: ... connected.# Comparing employees.salaries to emp1.salaries [FAIL]# Object definitions are not the same: CREATE TABLE `salaries` ( `emp_no` int(11) NOT NULL, `salary` int(11) NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL, PRIMARY KEY (`emp_no`,`from_date`), KEY `emp_no` (`emp_no`)- ) ENGINE=InnoDB DEFAULT CHARSET=latin1? ^^^^^+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1? ++ ^^^Compare failed. One or more differences found.

The following examples show how to generate a transformation report. Assume the following objectdefinitions:

Host1:

CREATE TABLE db1.table1 (num int, misc char(30));

Host2:

CREATE TABLE dbx.table3 (num int, notes char(30), misc char(55));

To generate a set of SQL statements that transform the definition of db1.table1 to dbx.table3, usethis command:

$ mysqldiff --server1=root@host1 --server2=root@host2 \

Page 251: MySQL Workbench

mysqldiskusage - Show Database Disk Usage

243

--changes-for=server1 --difftype=sql \ db1.table1:dbx.table3# server1 on host1: ... connected.# server2 on host2: ... connected.# Comparing db1.table1 to dbx.table3 [FAIL]# Transformation statments:

ALTER TABLE db1.table1 ADD COLUMN notes char(30) AFTER a, CHANGE COLUMN misc misc char(55);

Compare failed. One or more differences found.

To generate a set of SQL statements that transform the definition of dbx.table3 to db1.table1, usethis command:

$ mysqldiff --server1=root@host1 --server2=root@host2 \ --changes-for=server2 --difftype=sql \ db1.table1:dbx.table3# server1 on host1: ... connected.# server2 on host2: ... connected.# Comparing db1.table1 to dbx.table3 [FAIL]# Transformation statments:

ALTER TABLE dbx.table3 DROP COLUMN notes, CHANGE COLUMN misc misc char(30);

Compare failed. One or more differences found.

To generate a set of SQL statements that transform the definitions of dbx.table3 and db1.table1 inboth directions, use this command:

$ mysqldiff --server1=root@host1 --server2=root@host2 \ --show-reverse --difftype=sql \ db1.table1:dbx.table3# server1 on host1: ... connected.# server2 on host2: ... connected.# Comparing db1.table1 to dbx.table3 [FAIL]# Transformation statments:

# --destination=server1:ALTER TABLE db1.table1 ADD COLUMN notes char(30) AFTER a, CHANGE COLUMN misc misc char(55);

# --destination=server2:# ALTER TABLE dbx.table3# DROP COLUMN notes,# CHANGE COLUMN misc misc char(30);

Compare failed. One or more differences found.

mysqldiskusage - Show Database Disk Usage

SYNOPSIS

mysqldiskusage [options] db ...

DESCRIPTION

This utility displays disk space usage for one or more databases. The utility optionally displays disk usagefor the binary log, slow query log, error log, general query log, relay log, and InnoDB tablespaces. Thedefault is to show only database disk usage.

Page 252: MySQL Workbench

mysqldiskusage - Show Database Disk Usage

244

If the command line lists no databases, the utility shows the disk space usage for all databases.

Sizes displayed without a unit indicator such as MB are in bytes.

The utility determines the the location of the data directory by requesting it from the server. For a localserver, the utility obtains size information directly from files in the data directory and InnoDB homedirectory. In this case, you must have file system access to read those directories. Disk space usageshown includes the sum of all storage engine- specific files such as the .MYI and .MYD files for MyISAMand the tablespace files for InnoDB.

If the file system read fails, or if the server is not local, the utility cannot determine exact file sizes. It islimited to information that can be obtained from the system tables, which therefore should be consideredan estimate. For information read from the server, the account used to connect to the server must have theappropriate permissions to read any objects accessed during the operation.

If information requested requires file system access but is not available that way, the utility prints amessage that the information is not accessible. This occurs, for example, if you request log usage but theserver is not local and the log files cannot be examined directly.

To specify how to display output, use one of the following values with the --format option:

• grid (default)

Display output in grid or table format like that of the mysql monitor.

• csv

Display output in comma-separated values format.

• tab

Display output in tab-separated format.

• vertical

Display output in single-column format like that of the \G command for the mysql monitor.

To turn off the headers for csv or tab display format, specify the --no-headers option.

OPTIONS

mysqldiskusage accepts the following command-line options:

• --help

Display a help message and exit.

• --all, -a

Display all disk usage. This includes usage for databases, logs, and InnoDB tablespaces.

• --binlog, -b

Display binary log usage.

• --empty, -m

Include empty databases.

Page 253: MySQL Workbench

mysqldiskusage - Show Database Disk Usage

245

• --format=<format>, -f<format>

Specify the output display format. Permitted format values are grid, csv, tab, and vertical. The default isgrid.

• --innodb, -i

Display InnoDB tablespace usage. This includes information about the shared InnoDB tablespace aswell as .idb files for InnoDB tables with their own tablespace.

• --logs, -l

Display general query log, error log, and slow query log usage.

• --no-headers, -h

Do not display column headers. This option applies only for csv and tab output.

• --quiet, -q

Suppress informational messages.

• --relaylog, -r

Display relay log usage.

• --server=<server>

Connection information for the server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

• --verbose, -v

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug.

• --version

Display version information and exit.

For the --format option, the permitted values are not case sensitive. In addition, values may be specifiedas any unambiguous prefix of a valid value. For example, --format=g specifies the grid format. An erroroccurs if a prefix matches more than one valid value.

NOTES

You must provide connection parameters (user, host, password, and so forth) for an account that has theappropriate privileges for all objects accessed during the operation.

EXAMPLES

To show only the disk space usage for the employees and test databases in grid format (the default),use this command:

$ mysqldiskusage --server=root@localhost employees test# Source on localhost: ... connected.# Database totals:+------------+--------------+| db_name | total |+------------+--------------+| employees | 205,979,648 |

Page 254: MySQL Workbench

mysqlfailover - Automatic replication health monitoring and failover

246

| test | 4,096 |+------------+--------------+

Total database disk usage = 205,983,744 bytes or 196.00 MB

#...done.

To see all disk usage for the server in CSV format, use this command:

$ mysqldiskusage --server=root@localhost --format=csv -a -vv# Source on localhost: ... connected.# Database totals:db_name,db_dir_size,data_size,misc_files,totaltest1,0,0,0,0db3,0,0,0,0db2,0,0,0,0db1,0,0,0,0backup_test,19410,1117,18293,19410employees,242519463,205979648,242519463,448499111mysql,867211,657669,191720,849389t1,9849,1024,8825,9849test,56162,4096,52066,56162util_test_a,19625,2048,17577,19625util_test_b,17347,0,17347,17347util_test_c,19623,2048,17575,19623

Total database disk usage = 449,490,516 bytes or 428.00 MB

# Log information.# The general_log is turned off on the server.# The slow_query_log is turned off on the server.

# binary log information:Current binary log file = ./mysql-bin.000076log_file,size/data/mysql-bin.000076,125/data/mysql-bin.000077,125/data/mysql-bin.000078,556/data/mysql-bin.000079,168398223/data/mysql-bin.index,76

Total size of binary logs = 168,399,105 bytes or 160.00 MB

# Server is not an active slave - no relay log information.# InnoDB tablespace information:InnoDB_file,size,type,specificaton/data/ib_logfile0,5242880,log file,/data/ib_logfile1,5242880,log file,/data/ibdata1,220200960,shared tablespace,ibdata1:210M/data/ibdata2,10485760,shared tablespace,ibdata2:10M:autoextend/data/employees/departments.ibd,114688,file tablespace,/data/employees/dept_emp.ibd,30408704,file tablespace,/data/employees/dept_manager.ibd,131072,file tablespace,/data/employees/employees.ibd,23068672,file tablespace,/data/employees/salaries.ibd,146800640,file tablespace,/data/employees/titles.ibd,41943040,file tablespace,

Total size of InnoDB files = 494,125,056 bytes or 471.00 MB

#...done.

mysqlfailover - Automatic replication health monitoring and failover

SYNOPSIS

mysqlfailover [options]

Page 255: MySQL Workbench

mysqlfailover - Automatic replication health monitoring and failover

247

DESCRIPTION

This utility permits users to perform replication health monitoring and automatic failover on a replicationtopology consisting of a master and its slaves. The utility is designed to run interactively or continuouslyrefreshing the health information at periodic intervals. Its primary mission is to monitor the master for failureand when a failure occurs, execute failover to the best slave available. The utility accepts a list of slaves tobe considered the candidate slave.

This utility is designed to work exclusively for servers that support global transaction identifiers (GTIDs)and have GTID_MODE=ON. MySQL server versions 5.6.5 and higher support GTIDs. See the MySQLserver online reference manual for more information about setting up replication with GTIDs enabled.

The user can specify the interval in seconds to use for detecting the master status and generating thehealth report using the --interval option. At each interval, the utility will check to see if the server isalive via a ping operation followed by a check of the connector to detect if the server is still reachable. Theping operation can be controlled with the --ping option (see below).

If the master is found to be offline or unreachable, the utility will execute one of the following actions basedon the value of the --failover-mode option.

auto Execute automatic failover to the list of candidates first and if no slaves are viable, continue to locatea viable candidate from the list of slaves. If no slaves are found to be a viable candidate, the utility willgenerate and error and exit.

Once a candidate is found, the utility will conduct failover to the best slave. The command will test eachcandidate slave listed for the prerequisites. Once a candidate slave is elected, it is made a slave of each ofthe other slaves thereby collecting any transactions executed on other slaves but not the candidate. In thisway, the candidate becomes the most up-to-date slave.

elect This mode is the same as auto except if no candidates specified in the list of candidate slaves areviable, it does not check the remaining slaves and generates and error and exits.

fail This mode produces an error and does not failover when the master is downed. This mode is used toprovide periodic health monitoring without the failover action taken.

For all options that permit specifying multiple servers, the options require a comma-separated list ofconnection parameters in the following form where the password, port, and socket are optional.:

<*user*>[:<*passwd*>]@<*host*>[:<*port*>][:<*socket*>],

The utility permits users to discover slaves connected to the master. In order to use the discover slavesfeature, all slaves must use the –report-host and –report-port startup variables to specify the correcthostname and ip port of the slave. If these are missing or report the incorrect information, the slaves healthmay not be reported correctly or the slave may not be listed at all. The discover slaves feature ignores anyslaves it cannot connect to.

The discover slaves feature is run automatically on each interval.

The utility permits the user to specify an external script to execute before and after the switchover andfailover commands. The user can specify these with the --exec-before and --exec-after options.The return code of the script is used to determine success thus each script must report 0 (success) tobe considered successful. If a script returns a value other than 0, the result code is presented in an errormessage.

The utility also permits the user to specify a script to be used for detecting a downed master or anapplication-level event to trigger failover. This can be specified using the --exec-fail-check option.The return code for the script is used to invoke failover. A return code of 0 indicates failover should not take

Page 256: MySQL Workbench

mysqlfailover - Automatic replication health monitoring and failover

248

place. A return code other than 0 indicates failover should take place. This is checked at the start of eachinterval if a script is supplied. The timeout option is not used in this case and the script is run once at thestart of each interval.

The utility permits the user to log all actions taken during the commands. The --log option requires avalid path and file name of the file to use for logging operations. The log is active only when this option isspecified. The option --log-age specifies the age in days that log entries are kept. The default is seven(7) days. Older entries are automatically deleted from the log file (but only if the --log option is specified).

The format of the log file includes the date and time of the event, the level of the event (informational -INFO, warning - WARN, error - ERROR, critical failure - CRITICAL), and the message reported by theutility.

The interface provides the user with a number of options for displaying additional information. The user canchoose to see the replication health report (default), or choose to see the list of GTIDs in use, the UUIDs inuse, and if logging is enabled the contents of the log file. Each of these reports is described below.

health Display the replication health of the topology. This report is the default view for the interface. Bydefault, this includes the host name, port, role (MASTER or SLAVE) of the server, state of the server(UP = is connected, WARN = not connected but can ping, DOWN = not connected and cannot ping), theGTID_MODE, and health state.

The master health state is based on the following; if GTID_MODE=ON, the server must have binary logenabled, and there must exist a user with the REPLICATE SLAVE privilege.

The slave health state is based on the following; the IO_THREAD and SQL_THREADS must be running, itmust be connected to the master, there are no errors, the slave delay for non-gtid enabled scenarios is notmore than the threshold provided by the --max-position and the slave is reading the correct master logfile, and slave delay is not more than the --seconds-behind threshold option.

At each interval, if the discover slaves option was specified at startup and new slaves are discovered, thehealth report is refreshed.

gtid Display the contents of the GTID variables, @@GLOBAL.GTID_DONE, @@GLOBAL.GTID_LOST,and @@GLOBAL.GTID_OWNED.

UUID Display universally unique identifiers (UUIDs) for all servers.

Log This option is visible only if the --log option is specified. Show the contents of the log file. This canbe helpful to see at a later time when failover occurred and the actions or messages recorded at the time.

The user interface is designed to match the size of the terminal window in which it is run. A refresh optionis provided to permit users to resize their terminal windows or refresh the display at any time. However, theinterface will automatically resize to the terminal window on each interval.

The interface will display the name of the utility, the master’s status including binary log file, position, andfilters as well as the date and time of the next interval event.

The interface will also permit the user to scroll up or down through a list longer than what the terminalwindow permits. When a long list is presented, the scroll options become enabled. The user can scroll thelist up with the up arrow key and down with the down arrow key.

Use the --verbose option to see additional information in the health report and additional messagesduring failover.

OPTIONS

mysqlfailover accepts the following command-line options:

Page 257: MySQL Workbench

mysqlfailover - Automatic replication health monitoring and failover

249

• --help

Display a help message and exit.

• --candidates=<candidate slave connections>

Connection information for candidate slave servers for failover in the form:<user>[:<passwd>]@<host>[:<port>][:<socket>]. Valid only with failover command. List multiple slaves incomma- separated list.

• --discover-slaves-login=<user:password>

At startup, query master for all registered slaves and use the user name and password specifiedto connect. Supply the user and password in the form <user>[:<passwd>]. For example, –discover=joe:secret will use ‘joe’ as the user and ‘secret’ as the password for each discovered slave.

• --exec-after=<script>

Name of script to execute after failover or switchover. Script name may include the path.

• --exec-before=<script>

Name of script to execute before failover or switchover. Script name may include the path.

• --exec-fail-check=<script>

Name of script to execute on each interval to invoke failover.

• --exec-post-failover=<script>

Name of script to execute after failover is complete and the utility has refreshed the health report.

• --failover-mode=<mode>, -f <mode>

Action to take when the master fails. ‘auto’ = automatically fail to best slave, ‘elect’ = fail to candidate listor if no candidate meets criteria fail, ‘fail’ = take no action and stop when master fails. Default = ‘auto’.

• --force

Override the registration check on master for multiple instances of the console monitoring the samemaster.

• --interval=<seconds>, -i <seconds>

Interval in seconds for polling the master for failure and reporting health. Default = 15 seconds. Minimumis 5 seconds.

• --log=<log_file>

Specify a log file to use for logging messages

• --log-age=<days>

Specify maximum age of log entries in days. Entries older than this will be purged on startup. Default = 7days.

• --master=<connection>

Connection information for the master server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

Page 258: MySQL Workbench

mysqlfailover - Automatic replication health monitoring and failover

250

• --max-position=<position>

Used to detect slave delay. The maximum difference between the master’s log position and the slave’sreported read position of the master. A value greater than this means the slave is too far behind themaster. Default = 0.

• --ping=<number>

Number of ping attempts for detecting downed server. Note: on some platforms this is the same asnumber of seconds to wait for ping to return.

• --seconds-behind=<seconds>

Used to detect slave delay. The maximum number of seconds behind the master permitted before slaveis considered behind the master. Default = 0.

• --slaves=<slave connections>

Connection information for slave servers in the form: <user>[:<passwd>]@<host>[:<port>][:<socket>].List multiple slaves in comma-separated list.

• --timeout=<seconds>

Maximum timeout in seconds to wait for each replication command to complete. For example, timeout forslave waiting to catch up to master. Default = 3.

• --verbose, -v

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug.

• --version

Display version information and exit.

NOTES

The login user must have the appropriate permissions to execute SHOW SLAVE STATUS, SHOWMASTER STATUS, and SHOW VARIABLES on the appropriate servers as well as grant the REPLICATESLAVE privilege. The utility checks permissions for the master, slaves, and candidates at startup.

At startup, the console will attempt to register itself with the master. If another console is alreadyregistered, and the failover mode is auto or elect, the console will be blocked from running failover. Whena console quits, it deregisters itself from the master. If this process is broken, the user may override theregistration check by using the --force option.

EXAMPLES

To launch the utility, you must specify at a minimum the --master option and either the --discover-slaves-login option or the --slaves option. The option: option can be used in conjunction with the--slaves option to specify a list of known slaves (or slaves that do not report their host and ip) and todiscover any other slaves connected to the master.

An example of the user interface and some of the report views are shown in the following examples.

The default interface will display the replication health report like the following. In this example the log file isenabled. A sample startup command is shown below:

Page 259: MySQL Workbench

mysqlfailover - Automatic replication health monitoring and failover

251

$ mysqlfailover --master=root@localhost:3331 --discover-slaves-login=root

MySQL Replication Monitor and Failover UtilityFailover Mode = auto Next Interval = Mon Mar 19 15:56:03 2012

Master Information------------------Binary Log File Position Binlog_Do_DB Binlog_Ignore_DBmysql-bin.000001 571

Replication Health Status+------------+-------+---------+--------+------------+---------+| host | port | role | state | gtid_mode | health |+------------+-------+---------+--------+------------+---------+| localhost | 3331 | MASTER | UP | ON | OK || localhost | 3332 | SLAVE | UP | ON | OK || localhost | 3333 | SLAVE | UP | ON | OK || localhost | 3334 | SLAVE | UP | ON | OK |+------------+-------+---------+--------+------------+---------+Q-quit R-refresh H-health G-GTID Lists U-UUIDs L-log entries

Pressing the ‘q’ key will exit the utility. Pressing the ‘r’ key will refresh the current display. Pressing the ‘h’key will return to the replication health report.

If the user presses the ‘g’ key, the gtid report is shown like the following.:

MySQL Replication Monitor and Failover UtilityFailover Mode = auto Next Interval = Mon Mar 19 15:59:33 2012

Master Information------------------Binary Log File Position Binlog_Do_DB Binlog_Ignore_DBmysql-bin.000001 571

Transactions executed on the server+------------+-------+---------+-------------------------------------------+| host | port | role | uuid |+------------+-------+---------+-------------------------------------------+| localhost | 3331 | MASTER | 55C65A00-71FD-11E1-9F80-AC64EF85C961:1-2 || localhost | 3332 | SLAVE | 55C65A00-71FD-11E1-9F80-AC64EF85C961:1-2 || localhost | 3332 | SLAVE | 5DD30888-71FD-11E1-9F80-DC242138B7EC:1 || localhost | 3333 | SLAVE | 55C65A00-71FD-11E1-9F80-AC64EF85C961:1-2 |+------------+-------+---------+-------------------------------------------+Q-quit R-refresh H-health G-GTID Lists U-UUIDs L-log entries Up|Down-scroll

If the user continues to press the ‘g’ key, the display will cycle through the three gtid lists.

If the list is longer than the screen permits as shown in the example above, the scroll up and down help isalso shown. In this case, if the user presses the down arrow, the list will scroll down.

If the user presses the ‘u’ key, the list of UUIDs used in the topology are shown.:

MySQL Replication Monitor and Failover UtilityFailover Mode = auto Next Interval = Mon Mar 19 16:02:34 2012

Master Information------------------Binary Log File Position Binlog_Do_DB Binlog_Ignore_DBmysql-bin.000001 571

UUIDs+------------+-------+---------+---------------------------------------+| host | port | role | uuid |+------------+-------+---------+---------------------------------------+| localhost | 3331 | MASTER | 55c65a00-71fd-11e1-9f80-ac64ef85c961 || localhost | 3332 | SLAVE | 5dd30888-71fd-11e1-9f80-dc242138b7ec |

Page 260: MySQL Workbench

mysqlfailover - Automatic replication health monitoring and failover

252

| localhost | 3333 | SLAVE | 65ccbb38-71fd-11e1-9f80-bda8146bdb0a || localhost | 3334 | SLAVE | 6dd6abf4-71fd-11e1-9f80-d406a0117519 |+------------+-------+---------+---------------------------------------+Q-quit R-refresh H-health G-GTID Lists U-UUIDs L-log entries

If, once the master is detected as down and failover mode is auto or elect and there are viable candidateslaves, the failover feature will engage automatically and the user will see the failover messages appear.When failover is complete, the interface returns to monitoring replication health after 5 seconds. Thefollowing shows an example of failover occurring.:

Failover starting...# Candidate slave localhost:3332 will become the new master.# Preparing candidate for failover.# Creating replication user if it does not exist.# Stopping slaves.# Performing STOP on all slaves.# Switching slaves to new master.# Starting slaves.# Performing START on all slaves.# Checking slaves for errors.# Failover complete.# Discovering slaves for master at localhost:3332

Failover console will restart in 5 seconds.

After the failover event, the new topology is shown in the replication health report.:

MySQL Replication Monitor and Failover UtilityFailover Mode = auto Next Interval = Mon Mar 19 16:05:12 2012

Master Information------------------Binary Log File Position Binlog_Do_DB Binlog_Ignore_DBmysql-bin.000001 1117

UUIDs+------------+-------+---------+--------+------------+---------+| host | port | role | state | gtid_mode | health |+------------+-------+---------+--------+------------+---------+| localhost | 3332 | MASTER | UP | ON | OK || localhost | 3333 | SLAVE | UP | ON | OK || localhost | 3334 | SLAVE | UP | ON | OK |+------------+-------+---------+--------+------------+---------+

Q-quit R-refresh H-health G-GTID Lists U-UUIDs L-log entries

If the user presses the ‘l’ key and the --log option was specified, the interface will show the entries in thelog file. Note: example truncated for space allowance.:

MySQL Replication Monitor and Failover UtilityFailover Mode = auto Next Interval = Mon Mar 19 16:06:13 2012

Master Information------------------Binary Log File Position Binlog_Do_DB Binlog_Ignore_DBmysql-bin.000001 1117

Log File+-------------------------+----------------------------------------- ... --+| Date | Entry ... |+-------------------------+----------------------------------------- ... --+| 2012-03-19 15:55:33 PM | INFO Failover console started. ... || 2012-03-19 15:55:33 PM | INFO Failover mode = auto. ... || 2012-03-19 15:55:33 PM | INFO Getting health for master: localhos ... || 2012-03-19 15:55:33 PM | INFO Master status: binlog: mysql-bin.00 ... |+-------------------------+----------------------------------------- ... --+

Page 261: MySQL Workbench

mysqlindexcheck - Identify Potentially Redundant Table Indexes

253

Q-quit R-refresh H-health G-GTID Lists U-UUIDs L-log entries Up|Down-scroll

mysqlindexcheck - Identify Potentially Redundant Table Indexes

SYNOPSIS

mysqlindexcheck [options] db[:table] ...

DESCRIPTION

This utility reads the indexes for one or more tables and identifies duplicate and potentially redundantindexes.

To check all tables in a database, specify only the database name. To check a specific table, name thetable in db.table format. It is possible to mix database and table names.

You can scan tables in any database except the internal databases mysql, INFORMATION_SCHEMA,and performance_schema.

Depending on the index type, the utility applies the following rules to compare indexes (designated asidx_a and idx_b):

• BTREE

idx_b is redundant to idx_a if and only if the first n columns in idx_b also appear in idx_a. Orderand uniqueness count.

• HASH

idx_a and idx_b are duplicates if and only if they contain the same columns in the same order.Uniqueness counts.

• SPATIAL

idx_a and idx_b are duplicates if and only if they contain the same column (only one column ispermitted).

• FULLTEXT

idx_b is redundant to idx_a if and only if all columns in idx_b are included in idx_a. Order counts.

To see DROP statements to drop redundant indexes, specify the --show-drops option. To examinethe existing indexes, use the --verbose option, which prints the equivalent CREATE INDEX (or ALTERTABLE for primary keys.

To display the best or worst nonprimary key indexes for each table, use the --best or --worst option.This causes the output to show the best or worst indexes from tables with 10 or more rows. By default,each option shows five indexes. To override that, provide an integer value for the option.

To change the format of the index lists displayed for the --show-indexes, --best, and --worstoptions, use one of the following values with the --format option:

• grid (default)

Display output in grid or table format like that of the mysql monitor.

• csv

Display output in comma-separated values format.

Page 262: MySQL Workbench

mysqlindexcheck - Identify Potentially Redundant Table Indexes

254

• tab

Display output in tab-separated format.

• sql

print SQL statements rather than a list.

• vertical

Display output in single-column format like that of the \G command for the mysql monitor.

Note: The --best and --worst lists cannot be printed as SQL statements.

OPTIONS

mysqlindexcheck accepts the following command-line options:

• --help

Display a help message and exit.

• --best[=<N>]

If --stats is given, limit index statistics to the best N indexes. The default value of N is 5 if omitted.

• --format=<index_format>, -f<index_format>

Specify the index list display format for output produced by --stats. Permitted format values are grid,csv, tab, sql, and vertical. The default is grid.

• --server=<source>

Connection information for the server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

• --show-drops, -d

Display DROP statements for dropping indexes.

• --show-indexes, -i

Display indexes for each table.

• --skip, -s

Skip tables that do not exist.

• --stats

Show index performance statistics.

• --verbose, -v

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug.

• --version

Display version information and exit.

Page 263: MySQL Workbench

mysqlmetagrep - Search Database Object Definitions

255

• --worst[=<N>]

If --stats is given, limit index statistics to the worst N indexes. The default value of N is 5 if omitted.

NOTES

You must provide connection parameters (user, host, password, and so forth) for an account that has theappropriate privileges to read all objects accessed during the operation.

For the --format option, the permitted values are not case sensitive. In addition, values may be specifiedas any unambiguous prefix of a valid value. For example, --format=g specifies the grid format. An erroroccurs if a prefix matches more than one valid value.

EXAMPLES

To check all tables in the employees database on the local server to see the possible redundant andduplicate indexes, use this command:

$ mysqlindexcheck --server=root@localhost employees# Source on localhost: ... connected.# The following indexes are duplicates or redundant \ for table employees.dept_emp:#CREATE INDEX emp_no ON employees.dept_emp (emp_no) USING BTREE# may be redundant or duplicate of:ALTER TABLE employees.dept_emp ADD PRIMARY KEY (emp_no, dept_no)# The following indexes are duplicates or redundant \ for table employees.dept_manager:#CREATE INDEX emp_no ON employees.dept_manager (emp_no) USING BTREE# may be redundant or duplicate of:ALTER TABLE employees.dept_manager ADD PRIMARY KEY (emp_no, dept_no)# The following indexes are duplicates or redundant \ for table employees.salaries:#CREATE INDEX emp_no ON employees.salaries (emp_no) USING BTREE# may be redundant or duplicate of:ALTER TABLE employees.salaries ADD PRIMARY KEY (emp_no, from_date)# The following indexes are duplicates or redundant \ for table employees.titles:#CREATE INDEX emp_no ON employees.titles (emp_no) USING BTREE# may be redundant or duplicate of:ALTER TABLE employees.titles ADD PRIMARY KEY (emp_no, title, from_date)

mysqlmetagrep - Search Database Object Definitions

SYNOPSIS

mysqlmetagrep [options] [pattern | server] ...

DESCRIPTION

This utility searches for objects matching a given pattern on all the servers specified using instances ofthe --server option. It produces output that displays the matching objects. By default, the first nonoptionargument is taken to be the pattern unless the --pattern option is given. If the --pattern option isgiven, all nonoption arguments are treated as connection specifications.

Internally, the utility generates an SQL statement for searching the necessary tables in theINFORMATION_SCHEMA database on the designated servers and executes it in turn before collectingthe result and printing it as a table. Use the --sql option to have the utility display the statement rather

Page 264: MySQL Workbench

mysqlmetagrep - Search Database Object Definitions

256

than execute it. This can be useful if you want to feed the output of the statement to another applicationsuch as the mysql monitor.

The MySQL server supports two forms of patterns when matching strings: SQL Simple Patterns (used withthe LIKE operator) and POSIX Regular Expressions (used with the REGEXP operator).

By default, the utility uses the LIKE operator to match the name (and optionally, the body) of objects. Touse the REGEXP operator instead, use the --regexp option.

Note that since the REGEXP operator does substring searching, it is necessary to anchor the expressionto the beginning of the string if you want to match the beginning of the string.

To specify how to display output, use one of the following values with the --format option:

• grid (default)

Display output in grid or table format like that of the mysql monitor.

• csv

Display output in comma-separated values format.

• tab

Display output in tab-separated format.

• vertical

Display output in single-column format like that of the \G command for the mysql monitor.

SQL Simple Patterns

The simple patterns defined by the SQL standard consist of a string of characters with two characters thathave special meaning: % (percent) matches zero or more characters and _ (underscore) matches exactlyone character.

For example:

• 'mats%'

Match any string that starts with ‘mats’.

• '%kindahl%'

Match any string containing the word ‘kindahl’.

• '%_'

Match any string consisting of one or more characters.

POSIX Regular Expressions

POSIX regular expressions are more powerful than the simple patterns defined in the SQL standard. Aregular expression is a string of characters, optionally containing characters with special meaning:

• .

Match any character.

Page 265: MySQL Workbench

mysqlmetagrep - Search Database Object Definitions

257

• ^

Match the beginning of a string.

• $

Match the end of a string.

• [axy]

Match a, x, or y.

• [a-f]

Match any character in the range a to f (that is, a, b, c, d, e, or f).

• [^axy]

Match any character excepta, x, or y.

• a*

Match a sequence of zero or more a.

• a+

Match a sequence of one or more a.

• a?

Match zero or one a.

• ab|cd

Match ab or cd.

• a{5}

Match five instances of a.

• a{2,5}

Match from two to five instances of a.

• (abc)+

Match one or more repetitions of abc.

This is but a brief set of examples of regular expressions. The full syntax is described in the MySQLmanual, but can often be found in regex(7).

OPTIONS

mysqlmetagrep accepts the following command-line options:

• --help

Display a help message and exit.

• --body, -b

Page 266: MySQL Workbench

mysqlmetagrep - Search Database Object Definitions

258

Search the body of stored programs (procedures, functions, triggers, and events). The default is tomatch only the name.

• --database=<pattern>

Look only in databases matching this pattern.

• --format=<format>, -f<format>

Specify the output display format. Permitted format values are grid, csv, tab, and vertical. The default isgrid.

• --object-types=<types>, --search-objects=<types>

Search only the object types named in types, which is a comma-separated list of one or more of thevalues procedure, function, event, trigger, table, and database.

The default is to search in objects of all types.

• --pattern=<pattern>, -e=<pattern>

The pattern to use when matching. This is required when the first nonoption argument looks like aconnection specification rather than a pattern.

If the --pattern option is given, the first nonoption argument is treated as a connection specifier, notas a pattern.

• --regexp, --basic-regexp, -G

Perform pattern matches using the REGEXP operator. The default is to use LIKE for matching. Thisaffects the --database and --pattern options.

• --server=<source>

Connection information for a server to search in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.Use this option multiple times to search multiple servers.

• --sql, --print-sql, -p

Print rather than executing the SQL code that would be executed to find all matching objects. This canbe useful to save the statement for later execution or to use it as input for other programs.

• --version

Display version information and exit.

NOTES

For the --format option, the permitted values are not case sensitive. In addition, values may be specifiedas any unambiguous prefix of a valid value. For example, --format=g specifies the grid format. An erroroccurs if a prefix matches more than one valid value.

EXAMPLES

Find all objects with a name that matches the pattern 't_' (the letter t followed by any single character):

$ mysqlmetagrep --pattern="t_" --server=mats@localhost+------------------------+--------------+--------------+-----------+

Page 267: MySQL Workbench

mysqlprocgrep - Search Server Process Lists

259

| Connection | Object Type | Object Name | Database |+------------------------+--------------+--------------+-----------+| mats:*@localhost:3306 | TABLE | t1 | test || mats:*@localhost:3306 | TABLE | t2 | test || mats:*@localhost:3306 | TABLE | t3 | test |+------------------------+--------------+--------------+-----------+

To find all object that contain 't2' in the name or the body (for routines, triggers, and events):

$ mysqlmetagrep -b --pattern="%t2%" --server=mats@localhost:3306+------------------------+--------------+--------------+-----------+| Connection | Object Type | Object Name | Database |+------------------------+--------------+--------------+-----------+| root:*@localhost:3306 | TRIGGER | tr_foo | test || root:*@localhost:3306 | TABLE | t2 | test |+------------------------+--------------+--------------+-----------+

In the preceding output, the trigger name does not match the pattern, but is displayed because its bodydoes.

This is the same as the previous example, but using the REGEXP operator. Note that in the pattern it is notnecessary to add wildcards before or after t2:

$ mysqlmetagrep -Gb --pattern="t2" --server=mats@localhost+------------------------+--------------+--------------+-----------+| Connection | Object Type | Object Name | Database |+------------------------+--------------+--------------+-----------+| root:*@localhost:3306 | TRIGGER | tr_foo | test || root:*@localhost:3306 | TABLE | t2 | test |+------------------------+--------------+--------------+-----------+

mysqlprocgrep - Search Server Process Lists

SYNOPSIS

mysqlprocgrep [options]

DESCRIPTION

This utility scans the process lists for the servers specified using instances of the --server option andselects those that match the conditions specified using the --age and --match-xxx options. For aprocess to match, all conditions given must match. The utility then either prints the selected processes (thedefault) or executes certain actions on them.

If no --age or --match-xxx options are given, the utility selects all processes.

The --match-xxx options correspond to the columns in the INFORMATION_SCHEMA.PROCESSLISTtable. For example, --match-command specifies a matching condition for PROCESSLIST.COMMANDcolumn values. There is no --match-time option. To specify a condition based on process time, use --age.

Processes that can be seen and killed are subject to whether the account used to connect to the serverhas the PROCESS and SUPER privileges. Without PROCESS, the account cannot see processesbelonging to other accounts Without SUPER, the account cannot kill processes belonging to otheraccounts

To specify how to display output, use one of the following values with the --format option:

• grid (default)

Display output in grid or table format like that of the mysql monitor.

Page 268: MySQL Workbench

mysqlprocgrep - Search Server Process Lists

260

• csv

Display output in comma-separated values format.

• tab

Display output in tab-separated format.

• vertical

Display output in single-column format like that of the \G command for the mysql monitor.

Options

mysqlprocgrep accepts the following command-line options:

• --help

Display a help message and exit.

• --age=<time>

Select only processes that have been in the current state more than a given time. The time value canbe specified in two formats: either using the hh:mm:ss format, with hours and minutes optional, or as asequence of numbers with a suffix giving the period size.

The permitted suffixes are s (second), m (minute), h (hour), d (day), and w (week). For example, 4h15mmean 4 hours and 15 minutes.

For both formats, the specification can optionally be preceded by + or -, where + means older than thegiven time, and - means younger than the given time.

• --format=<format>, -f<format>

Specify the output display format. Permitted format values are grid, csv, tab, and vertical. The default isgrid.

• --kill-connection

Kill the connection for all matching processes (like the KILL CONNECTION statement).

• --kill-query

Kill the query for all matching processes (like the KILL QUERY statement).

• --match-command=<pattern>

Match all processes where the Command field matches the pattern.

• --match-db=<pattern>

Match all processes where the Db field matches the pattern.

• --match-host=<pattern>

Match all processes where the Host field matches the pattern.

• --match-info=<pattern>

Page 269: MySQL Workbench

mysqlprocgrep - Search Server Process Lists

261

Match all processes where the Info field matches the pattern.

• --match-state=<pattern>

Match all processes where the State field matches the pattern.

• --match-user=<pattern>

Match all processes where the User field matches the pattern.

• --print

Print information about the matching processes. This is the default if no --kill-connection or --kill-query option is given. If a kill option is given, --print prints information about the processesbefore killing them.

• --regexp, --basic-regexp, -G

Perform pattern matches using the REGEXP operator. The default is to use LIKE for matching. Thisaffects the --match-xxx options.

• --server=<source>

Connection information for a server to search in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.Use this option multiple times to search multiple servers.

• --sql, --print-sql, -Q

Instead of displaying the selected processes, emit the SELECT statement that retrieves informationabout them. If the --kill-connection or --kill-query option is given, the utility generates astored procedure named kill_processes() for killing the queries rather than a SELECT statement.

• --sql-body

Like --sql, but produces the output as the body of a stored procedure without the CREATEPROCEDURE part of the definition. This could be used, for example, to generate an event for the serverEvent Manager.

When used with a kill option, code for killing the matching queries is generated. Note that it is notpossible to execute the emitted code unless it is put in a stored routine, event, or trigger. For example,the following code could be generated to kill all idle connections for user www-data:

$ mysqlprocgrep --kill-connection --sql-body \> --match-user=www-data --match-state=sleepDECLARE kill_done INT;DECLARE kill_cursor CURSOR FOR SELECT Id, User, Host, Db, Command, Time, State, Info FROM INFORMATION_SCHEMA.PROCESSLIST WHERE user LIKE 'www-data' AND State LIKE 'sleep'OPEN kill_cursor;BEGIN DECLARE id BIGINT; DECLARE EXIT HANDLER FOR NOT FOUND SET kill_done = 1; kill_loop: LOOP FETCH kill_cursor INTO id;

Page 270: MySQL Workbench

mysqlreplicate - Set Up and Start Replication Between Two Servers

262

KILL CONNECTION id; END LOOP kill_loop;END;CLOSE kill_cursor;

• --verbose, -v

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug.

• --version

Display version information and exit.

NOTES

For the --format option, the permitted values are not case sensitive. In addition, values may be specifiedas any unambiguous prefix of a valid value. For example, --format=g specifies the grid format. An erroroccurs if a prefix matches more than one valid value.

EXAMPLES

For each example, assume that the root user on localhost has sufficient privileges to kill queries andconnections.

Kill all queries created by user mats that are younger than 1 minute:

mysqlprocgrep --server=root@localhost \ --match-user=mats --age=-1m --kill-query

Kill all connections that have been idle for more than 1 hour:

mysqlprocgrep --server=root@localhost \ --match-command=sleep --age=1h --kill-connection

mysqlreplicate - Set Up and Start Replication Between Two Servers

SYNOPSIS

mysqlreplicate [options]

DESCRIPTION

This utility permits an administrator to start replication from one server (the master) to another (the slave).The user provides login information for the slave and connection information for connecting to the master.It is also possible to specify a database to be used to test replication.

The utility reports conditions where the storage engines on the master and the slave differ. It also reportsa warning if the InnoDB storage engine differs on the master and slave. For InnoDB to be the same, bothservers must be running the same “type” of InnoDB (built-in or the InnoDB Plugin), and InnoDB on bothservers must have the same major and minor version numbers and enabled state.

By default, the utility issues warnings for mismatches between the sets of storage engines, the defaultstorage engine, and the InnoDB storage engine. To produce errors instead, use the --pedantic option,which requires storage engines to be the same on the master and slave.

The -vv option displays any discrepancies between the storage engines and InnoDB values, with orwithout the --pedantic option.

Replication can be started using one of the following strategies.

Page 271: MySQL Workbench

mysqlreplicate - Set Up and Start Replication Between Two Servers

263

• Start from the current position (default)

Start replication from the current master binary log file and position. The utility uses the SHOW MASTERSTATUS statement to retrieve this information.

• Start from the beginning

Start replication from the first event recorded in the master binary log. To do this, use the --start-from-beginning option.

• Start from a binary log file

Start replication from the first event in a specific master binary log file. To do this, use the --master-log-file option.

• Start from a specific event

Start replication from specific event coordinates (specific binary log file and position). To do this, use the--master-log-file and --master-log-pos options.

OPTIONS

mysqlreplicate accepts the following command-line options:

• --help

Display a help message and exit.

• --master=<master>

Connection information for the master server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

• --master-log-file=<master_log_file>

Begin replication from the beginning of this master log file.

• --master-log-pos=<master_log_pos>

Begin replication from this position in the master log file. This option is not valid unless --master-log-file is given.

• --pedantic, -p

Fail if both servers do not have the same set of storage engines, the same default storage engine, andthe same InnoDB storage engine.

• --rpl-user=<replication_user>

The user and password for the replication user, in name:passwd format. The default is rpl:rpl.

• --slave=<slave>

Connection information for the slave server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

• --start-from-beginning, -b

Start replication at the beginning of events logged in the master binary log. This option is not valid unlessboth --master-log-file and --master-log-pos are given.

Page 272: MySQL Workbench

mysqlreplicate - Set Up and Start Replication Between Two Servers

264

• --test-db=<test_database>

The database name to use for testing the replication setup. If this option is not given, no testing is done,only error checking.

• --verbose, -v

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug.

• --version

Display version information and exit.

NOTES

The login user for the master server must have the appropriate permissions to grant access to alldatabases and the ability to create a user account. For example, the user account used to connect to themaster must have the WITH GRANT OPTION privilege.

The server IDs on the master and slave must be nonzero and unique. The utility reports an error if theserver ID is 0 on either server or the same on the master and slave. Set these values before starting thisutility.

EXAMPLES

To set up replication between two MySQL instances running on different ports of the same host using thedefault settings, use this command:

$ mysqlreplicate --master=root@localhost:3306 \ --slave=root@localhost:3307 --rpl-user=rpl:rpl# master on localhost: ... connected.# slave on localhost: ... connected.# Checking for binary logging on master...# Setting up replication...# ...done.

The following command uses --pedantic to ensure that replication between the master and slave issuccessful if and only if both servers have the same storage engines available, the same default storageengine, and the same InnoDB storage engine:

$ mysqlreplicate --master=root@localhost:3306 \ --slave=root@localhost:3307 --rpl-user=rpl:rpl -vv --pedantic# master on localhost: ... connected.# slave on localhost: ... connected.# master id = 2# slave id = 99# Checking InnoDB statistics for type and version conflicts.# Checking storage engines...# Checking for binary logging on master...# Setting up replication...# Flushing tables on master with read lock...# Connecting slave to master...# CHANGE MASTER TO MASTER_HOST = [...omitted...]# Starting slave...# status: Waiting for master to send event# error: 0:# Unlocking tables on master...# ...done.

The following command starts replication from the current position of the master (which is the default):

Page 273: MySQL Workbench

mysqlrpladmin - Administration utility for MySQL replication

265

$ mysqlreplicate --master=root@localhost:3306 \ --slave=root@localhost:3307 --rpl-user=rpl:rpl # master on localhost: ... connected. # slave on localhost: ... connected. # Checking for binary logging on master... # Setting up replication... # ...done.

The following command starts replication from the beginning of recorded events on the master:

$ mysqlreplicate --master=root@localhost:3306 \ --slave=root@localhost:3307 --rpl-user=rpl:rpl \ --start-from-beginning # master on localhost: ... connected. # slave on localhost: ... connected. # Checking for binary logging on master... # Setting up replication... # ...done.

The following command starts replication from the beginning of a specific master binary log file:

$ mysqlreplicate --master=root@localhost:3306 \ --slave=root@localhost:3307 --rpl-user=rpl:rpl \ --master-log-file=my_log.000003 # master on localhost: ... connected. # slave on localhost: ... connected. # Checking for binary logging on master... # Setting up replication... # ...done.

The following command starts replication from specific master binary log coordinates (specific log file andposition):

$ mysqlreplicate --master=root@localhost:3306 \ --slave=root@localhost:3307 --rpl-user=rpl:rpl \ --master-log-file=my_log.000001 --master-log-pos=96 # master on localhost: ... connected. # slave on localhost: ... connected. # Checking for binary logging on master... # Setting up replication... # ...done.

RECOMMENDATIONS

You should set read_only=1 in the my.cnf file for the slave to ensure that no accidental data changes,such as INSERT, DELETE, UPDATE, and so forth, are permitted on the slave other than those producedby events read from the master.

Use the --pedantic and -vv options for setting up replication on production servers to avoid possibleproblems with differing storage engines.

mysqlrpladmin - Administration utility for MySQL replication

SYNOPSIS

mysqlrpladmin [options]

DESCRIPTION

This utility permits users to perform administrative actions on a replication topology consisting of a masterand its slaves. The utility is designed to make it easy to recover from planned maintenance of the master orfrom an event that takes the master offline unexpectedly.

Page 274: MySQL Workbench

mysqlrpladmin - Administration utility for MySQL replication

266

The act of taking the master offline intentionally and switching control to another slave is called switchover.In this case, there is no loss of transactions as the master is locked and all slaves are allowed to catch upto the master. Once the slaves have read all events from the master, the master is shutdown and controlswitched to a slave (in this case called a candidate slave).

Recovering from the loss of a downed master is more traumatic and since there is no way to know whattransactions the master may have failed to send, the new master (called a candidate slave) must be theslave that is most up-to-date. How this is determined depends on the version of the server (see below).However, it can result in the loss of some transactions that were executed on the downed master but notsent. The utility accepts a list of slaves to be considered the candidate slave. If no slave is found to meetthe requirements, the operation will search the list of known slaves.

The utility also provides a number of useful commands for managing a replication topology including thefollowing.

elect This command is available to only those servers supporting global transaction identifiers (GTIDs),perform best slave election and report best slave to use in the event a switchover or failover is required.Best slave election is simply the first slave to meet the prerequisites. GTIDs are supported in version 5.6.5and higher.

failover This command is available to only those servers supporting GTIDs. Conduct failover to the bestslave. The command will test each candidate slave listed for the prerequisites. Once a candidate slaveis elected, it is made a slave of each of the other slaves thereby collecting any transactions executed onother slaves but not the candidate. In this way, the candidate becomes the most up-to-date slave.

gtid This command is available to only those servers supporting GTIDs. It displays thecontents of the GTID variables, @@GLOBAL.GTID_DONE, @@GLOBAL.GTID_LOST, and@@GLOBAL.GTID_OWNED. The command also displays universally unique identifiers (UUIDs) for allservers.

health Display the replication health of the topology. By default, this includes the host name, port, role(MASTER or SLAVE) of the server, state of the server (UP = is connected, WARN = not connected but canping, DOWN = not connected and cannot ping), the GTID_MODE, and health state.

The master health state is based on the following; if GTID_MODE=ON, the server must have binary logenabled, and there must exist a user with the REPLICATE SLAVE privilege.

The slave health state is based on the following; the IO_THREAD and SQL_THREADS must be running, itmust be connected to the master, there are no errors, the slave delay for non-gtid enabled scenarios is notmore than the threshold provided by the --max-position and the slave is reading the correct master logfile, and slave delay is not more than the --seconds-behind threshold option.

reset Execute the STOP SLAVE and RESET SLAVE commands on all slaves.

start Execute the START SLAVE command on all slaves.

stop Execute the STOP SLAVE command on all slaves.

switchover Perform slave promotion to a specified candidate slave as designated by the --new-masteroption. This command is available for both gtid-enabled servers and non-gtid-enabled scenarios.

Detection of a downed master is performed as follows. If the connection to the master is lost, wait --timeout seconds and check again. If the master connection is lost and the master cannot be pinged orreconnected, the failover event occurs.

For all commands that require specifying multiple servers, the options require a comma-separated list ofconnection parameters in the following form where the password, port, and socket are optional.:

Page 275: MySQL Workbench

mysqlrpladmin - Administration utility for MySQL replication

267

<*user*>[:<*passwd*>]@<*host*>[:<*port*>][:<*socket*>],

The utility permits users to discover slaves connected to the master. In order to use the discover slavesfeature, all slaves must use the –report-host and –report-port startup variables to specify the correcthostname and ip port of the slave. If these are missing or report the incorrect information, the slaves healthmay not be reported correctly or the slave may not be listed at all. The discover slaves feature ignores anyslaves it cannot connect to.

The utility permits the user to demote a master to a slave during the switchover operation. The --demote-master option tells the utility to, once the new master is established, make the old master a slave of thenew master. This permits rotation of the master role among a set of servers.

The utility permits the user to specify an external script to execute before and after the switchover andfailover commands. The user can specify these with the --exec-before and --exec-after options.The return code of the script is used to determine success thus each script must report 0 (success) tobe considered successful. If a script returns a value other than 0, the result code is presented in an errormessage.

The utility permits the user to log all actions taken during the commands. The --log option requires avalid path and file name of the file to use for logging operations. The log is active only when this option isspecified. The option --log-age specifies the age in days that log entries are kept. The default is seven(7) days. Older entries are automatically deleted from the log file (but only if the --log option is specified).

The format of the log file includes the date and time of the event, the level of the event (informational -INFO, warning - WARN, error - ERROR, critical failure - CRITICAL), and the message reported by theutility.

The utility has a number of options each explained in more detail below. Some of the options are specificto certain commands. Warning messages are issued whenever an option is used that does not apply tothe command requested. A brief overview of each command and its options is presented in the followingparagraphs.

The elect, failover, start, stop, and reset commands require either the --slaves option to list all of theslaves in the topology or the --discover-slaves-login option to provide the user name and passwordto discover any slaves in the topology that are registered to the master but are not listed in the --slavesoption.

The options required for the health and gtid commands include the --master option to specify the existingmaster, and either the --slaves option to list all of the slaves in the topology or the --discover-slaves-login option to provide the user name and password to discover any slaves in the topology thatare registered to the master but are not listed in the --slaves option.

Use the --verbose option to see additional information in the health report and additional messagesduring switchover or failover.

The options required for switchover include the --master option to specify the existing master, the --new-master option to specify the candidate slave (the slave to become the new master.

OPTIONS

mysqlrpladmin accepts the following command-line options:

• --help

Display a help message and exit.

• --candidates=<candidate slave connections>

Page 276: MySQL Workbench

mysqlrpladmin - Administration utility for MySQL replication

268

Connection information for candidate slave servers for failover in the form:<user>[:<passwd>]@<host>[:<port>][:<socket>]. Valid only with failover command. List multiple slaves incomma- separated list.

• --demote-master

Make master a slave after switchover.

• --discover-slaves-login=<user:password>

At startup, query master for all registered slaves and use the user name and password specifiedto connect. Supply the user and password in the form <user>[:<passwd>]. For example, –discover=joe:secret will use ‘joe’ as the user and ‘secret’ as the password for each discovered slave.

• --exec-after=<script>

Name of script to execute after failover or switchover. Script name may include the path.

• --exec-before=<script>

Name of script to execute before failover or switchover. Script name may include the path.

• --format=<format>, -f <format>

Display the replication health output in either grid (default), tab, csv, or vertical format.

• --log=<log_file>

Specify a log file to use for logging messages

• --log-age=<days>

Specify maximum age of log entries in days. Entries older than this will be purged on startup. Default = 7days.

• --master=<connection>

Connection information for the master server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

• --max-position=<position>

Used to detect slave delay. The maximum difference between the master’s log position and the slave’sreported read position of the master. A value greater than this means the slave is too far behind themaster. Default = 0.

• --new-master=<connection>

Connection information for the slave to be used to replace the master for switchover in the form:<user>[:<passwd>]@<host>[:<port>][:<socket>]. Valid only with switchover command.

• --no-health

Turn off health report after switchover or failover.

• --ping=<number>

Number of ping attempts for detecting downed server. Note: on some platforms this is the same asnumber of seconds to wait for ping to return.

Page 277: MySQL Workbench

mysqlrpladmin - Administration utility for MySQL replication

269

• --quiet, -q

Turn off all messages for quiet execution.

• --seconds-behind=<seconds>

Used to detect slave delay. The maximum number of seconds behind the master permitted before slaveis considered behind the master. Default = 0.

• --slaves=<slave connections>

Connection information for slave servers in the form: <user>[:<passwd>]@<host>[:<port>][:<socket>].List multiple slaves in comma-separated list.

• --timeout=<seconds>

Maximum timeout in seconds to wait for each replication command to complete. For example, timeout forslave waiting to catch up to master. Default = 3. Also used to check down status of master. Failover willwait timeout seconds to check master response. If no response, failover event occurs.

• --verbose, -v

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug.

• --version

Display version information and exit.

NOTES

The login user must have the appropriate permissions to execute SHOW SLAVE STATUS, SHOWMASTER STATUS, and SHOW VARIABLES on the appropriate servers as well as grant the REPLICATESLAVE privilege. The utility checks permissions for the master, slaves, and candidates at startup.

The --force option cannot be used with the failover command.

EXAMPLES

To perform best slave election for a topology with GTID_MODE=ON (server version 5.6.5 or higher) whereall slaves are specified with the --slaves1 option, run the following command.:

$ mysqlrpladmin --master=root@localhost:3331 \ --slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 elect# Electing candidate slave from known slaves.# Best slave found is located on localhost:3332.# ...done.

To perform best slave election supplying a candidate list, use the following command.:

$ mysqlrpladmin --master=root@localhost:3331 \ --slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \ --candidates=root@localhost:3333,root@localhost:3334 elect# Electing candidate slave from candidate list then slaves list.# Best slave found is located on localhost:3332.# ...done.

To perform failover after a master has failed, use the following command.:

$ mysqlrpladmin \

Page 278: MySQL Workbench

mysqlrpladmin - Administration utility for MySQL replication

270

--slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \ --candidates=root@localhost:3333,root@localhost:3334 failover# Performing failover.# Candidate slave localhost:3333 will become the new master.# Preparing candidate for failover.# Creating replication user if it does not exist.# Stopping slaves.# Performing STOP on all slaves.# Switching slaves to new master.# Starting slaves.# Performing START on all slaves.# Checking slaves for errors.# Failover complete.# ...done.

To see the replication health of a topology with GTID_MODE=ON (server version 5.6.5 or higher) anddiscover all slaves attached to the master, run the following command. We use the result of the failovercommand above.:

$ mysqlrpladmin --master=root@localhost:3333 \ --slaves=root@localhost:3332,root@localhost:3334 health# Getting health for master: localhost:3333.## Replication Topology Health:+------------+-------+---------+--------+------------+---------+| host | port | role | state | gtid_mode | health |+------------+-------+---------+--------+------------+---------+| localhost | 3333 | MASTER | UP | ON | OK || localhost | 3332 | SLAVE | UP | ON | OK || localhost | 3334 | SLAVE | UP | ON | OK |+------------+-------+---------+--------+------------+---------+# ...done.

To view a detailed replication health report but with all of the replication health checks revealed, use the --verbose option as shown below. In this example, we use vertical format to make viewing easier.:

$ mysqlrpladmin --master=root@localhost:3331 \ --slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \ --verbose health# Getting health for master: localhost:3331.# Attempting to contact localhost ... Success# Attempting to contact localhost ... Success# Attempting to contact localhost ... Success# Attempting to contact localhost ... Success## Replication Topology Health:************************* 1. row ************************* host: localhost port: 3331 role: MASTER state: UP gtid_mode: ON health: OK version: 5.6.5-m8-debug-log master_log_file: mysql-bin.000001 master_log_pos: 571 IO_Thread: SQL_Thread: Secs_Behind: Remaining_Delay: IO_Error_Num: IO_Error:************************* 2. row ************************* host: localhost port: 3332 role: SLAVE

Page 279: MySQL Workbench

mysqlrpladmin - Administration utility for MySQL replication

271

state: UP gtid_mode: ON health: OK version: 5.6.5-m8-debug-log master_log_file: mysql-bin.000001 master_log_pos: 571 IO_Thread: Yes SQL_Thread: Yes Secs_Behind: 0 Remaining_Delay: No IO_Error_Num: 0 IO_Error:************************* 3. row ************************* host: localhost port: 3333 role: SLAVE state: UP gtid_mode: ON health: OK version: 5.6.5-m8-debug-log master_log_file: mysql-bin.000001 master_log_pos: 571 IO_Thread: Yes SQL_Thread: Yes Secs_Behind: 0 Remaining_Delay: No IO_Error_Num: 0 IO_Error:************************* 4. row ************************* host: localhost port: 3334 role: SLAVE state: UP gtid_mode: ON health: OK version: 5.6.5-m8-debug-log master_log_file: mysql-bin.000001 master_log_pos: 571 IO_Thread: Yes SQL_Thread: Yes Secs_Behind: 0 Remaining_Delay: No IO_Error_Num: 0 IO_Error:4 rows.# ...done.

To run the same failover command above, but specify a log file, use the following command.:

$ mysqlrpladmin \ --slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \ --candidates=root@localhost:3333,root@localhost:3334 \ --log=test_log.txt failover# Performing failover.# Candidate slave localhost:3333 will become the new master.# Preparing candidate for failover.# Creating replication user if it does not exist.# Stopping slaves.# Performing STOP on all slaves.# Switching slaves to new master.# Starting slaves.# Performing START on all slaves.# Checking slaves for errors.# Failover complete.# ...done.

After this command, the log file will contain entries like the following:

Page 280: MySQL Workbench

mysqlrpladmin - Administration utility for MySQL replication

272

2012-03-19 14:44:17 PM INFO Executing failover command...2012-03-19 14:44:17 PM INFO Performing failover.2012-03-19 14:44:17 PM INFO Candidate slave localhost:3333 will become the new master.2012-03-19 14:44:17 PM INFO Preparing candidate for failover.2012-03-19 14:44:19 PM INFO Creating replication user if it does not exist.2012-03-19 14:44:19 PM INFO Stopping slaves.2012-03-19 14:44:19 PM INFO Performing STOP on all slaves.2012-03-19 14:44:19 PM INFO Switching slaves to new master.2012-03-19 14:44:20 PM INFO Starting slaves.2012-03-19 14:44:20 PM INFO Performing START on all slaves.2012-03-19 14:44:20 PM INFO Checking slaves for errors.2012-03-19 14:44:21 PM INFO Failover complete.2012-03-19 14:44:21 PM INFO ...done.

To perform switchover and demote the current master to a slave, use the following command.:

$ mysqlrpladmin --master=root@localhost:3331 \ --slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \ --new-master=root@localhost:3332 --demote-master switchover# Performing switchover from master at localhost:3331 to slave at localhost:3332.# Checking candidate slave prerequisites.# Waiting for slaves to catch up to old master.# Stopping slaves.# Performing STOP on all slaves.# Demoting old master to be a slave to the new master.# Switching slaves to new master.# Starting all slaves.# Performing START on all slaves.# Checking slaves for errors.# Switchover complete.# ...done.

If the replication health report is generated on the topology following the above command, it will display theold master as a slave as shown below.:

# Replication Topology Health:+------------+-------+---------+--------+------------+---------+| host | port | role | state | gtid_mode | health |+------------+-------+---------+--------+------------+---------+| localhost | 3332 | MASTER | UP | ON | OK || localhost | 3331 | SLAVE | UP | ON | OK || localhost | 3333 | SLAVE | UP | ON | OK || localhost | 3334 | SLAVE | UP | ON | OK |+------------+-------+---------+--------+------------+---------+

To use the discover slaves feature, you can omit the --slaves option if and only if all slaves report theirhost and port to the master. A sample command to generate a replication health report with discovery isshown below. he option: option can be used in conjunction with the --slaves option to specify a list ofknown slaves (or slaves that do not report their host and ip) and to discover any other slaves connected tothe master.:

$ mysqlrpladmin --master=root@localhost:3332 \ --discover-slaves-login=root health# Discovering slaves for master at localhost:3332# Getting health for master: localhost:3332.## Replication Topology Health:+------------+-------+---------+--------+------------+---------+| host | port | role | state | gtid_mode | health |+------------+-------+---------+--------+------------+---------+| localhost | 3332 | MASTER | UP | ON | OK || localhost | 3331 | SLAVE | UP | ON | OK || localhost | 3333 | SLAVE | UP | ON | OK || localhost | 3334 | SLAVE | UP | ON | OK |+------------+-------+---------+--------+------------+---------+

Page 281: MySQL Workbench

mysqlrplcheck - Check Replication Prerequisities

273

# ...done.

mysqlrplcheck - Check Replication Prerequisities

SYNOPSIS

mysqlrplcheck [options]

DESCRIPTION

This utility checks the prerequisites for replication between a master and a slave. These checks (calledtests) are designed to ensure a healthy replication setup. The utility performs the following tests:

1. Is the binary log enabled on the master?

2. Are there binary logging exceptions (such as *_do_db or *_ignore_db settings)? If so, display them.

3. Does the replication user exist on the master with the correct privileges?

4. Are there server_id conflicts?

5. Is the slave connected to this master? If not, display the master host and port.

6. Are there conflicts between the master.info file on the slave and the values shown in SHOWSLAVE STATUS on the master?

7. Are the InnoDB configurations compatible (plugin vs. native)?

8. Are the storage engines compatible (have same on slave as master)?

9. Are the lower_case_tables_names settings compatible? Warn if there are settings for lowercase/uppercase table names that can cause problems. See Bug #59240.

10. Is the slave behind the master?

The utility runs each test in turn unless there is a fatal error preventing further testing, such as a loss ofconnection to the servers.

Each test can complete with one of the following states: pass (the prerequisites are met), fail (theprerequisites were met but one or more errors occurred or there are exceptions to consider), or warn (thetest found some unusual settings that should be examined further but may not be in error).

Use the --verbose option to see additional information such as server IDs, lower_case_table_namesettings, and the contents of the master information file on the slave.

To see the values from the SHOW SLAVE STATUS statement, use the --show-slave-status option.

OPTIONS

mysqlrplcheck accepts the following command-line options:

• --help

Display a help message and exit.

• --master=<source>

Connection information for the master server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

Page 282: MySQL Workbench

mysqlrplcheck - Check Replication Prerequisities

274

• --master-info-file=<file>

The name of the master information file on the slave. The default is master.info read from the datadirectory. Note: This option requires that you run the utility on the slave and that you have appropriateread access for the file.

• --quiet, -q

Turn off all messages for quiet execution. Note: Errors and warnings are not suppressed.

• --show-slave-status, -s

Display the values from SHOW SLAVE STATUS on the master.

• --slave=<source>

Connection information for the slave server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

• --suppress

Suppress warning messages.

• --verbose, -v

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug.

• --version

Display version information and exit.

• --width=<number>

Change the display width of the test report. The default is 75 characters.

NOTES

The login user must have the appropriate permissions to execute SHOW SLAVE STATUS, SHOWMASTER STATUS, and SHOW VARIABLES on the appropriate servers.

EXAMPLES

To check the prerequisites of a master and slave that currently are actively performing replication, use thefollowing command:

$ mysqlrplcheck --master=root@host1:3310 --slave=root@host2:3311# master on host1: ... connected.# slave on host2: ... connected.Test Description Status------------------------------------------------------------------------Checking for binary logging on master [pass]Are there binlog exceptions? [pass]Replication user exists? [pass]Checking server_id values [pass]Is slave connected to master? [pass]Check master information file [pass]Checking InnoDB compatibility [pass]Checking storage engines compatibility [pass]Checking lower_case_table_names settings [pass]Checking slave delay (seconds behind master) [pass]# ...done.

Page 283: MySQL Workbench

mysqlrplcheck - Check Replication Prerequisities

275

As shown in the example, you must provide valid login information for both the master and the slave.

To perform the same command but also display the contents of the master information file on the slave andthe values of SHOW SLAVE STATUS as well as additional details, use this command:

$ mysqlrplcheck --master=root@host1:3310 --slave=root@host2:3311 \ --show-slave-status -vv# master on host1: ... connected.# slave on host2: ... connected.Test Description Status------------------------------------------------------------------------Checking for binary logging on master [pass]Are there binlog exceptions? [pass]Replication user exists? [pass]Checking server_id values [pass]

master id = 10 slave id = 11

Is slave connected to master? [pass]Check master information file [pass]

## Master information file:# Master_Log_File : clone-bin.000001 Read_Master_Log_Pos : 482 Master_Host : host1 Master_User : rpl Master_Password : XXXX Master_Port : 3310 Connect_Retry : 60 Master_SSL_Allowed : 0 Master_SSL_CA_File : Master_SSL_CA_Path : Master_SSL_Cert : Master_SSL_Cipher : Master_SSL_Key : Master_SSL_Verify_Server_Cert : 0

Checking InnoDB compatibility [pass]Checking storage engines compatibility [pass]Checking lower_case_table_names settings [pass]

Master lower_case_table_names: 2 Slave lower_case_table_names: 2

Checking slave delay (seconds behind master) [pass]

## Slave status:# Slave_IO_State : Waiting for master to send event Master_Host : host1 Master_User : rpl Master_Port : 3310 Connect_Retry : 60 Master_Log_File : clone-bin.000001 Read_Master_Log_Pos : 482 Relay_Log_File : clone-relay-bin.000006 Relay_Log_Pos : 251 Relay_Master_Log_File : clone-bin.000001 Slave_IO_Running : Yes Slave_SQL_Running : Yes Replicate_Do_DB : Replicate_Ignore_DB : Replicate_Do_Table :

Page 284: MySQL Workbench

mysqlrplshow - Show Slaves for Master Server

276

Replicate_Ignore_Table : Replicate_Wild_Do_Table : Replicate_Wild_Ignore_Table : Last_Errno : 0 Last_Error : Skip_Counter : 0 Exec_Master_Log_Pos : 482 Relay_Log_Space : 551 Until_Condition : None Until_Log_File : Until_Log_Pos : 0 Master_SSL_Allowed : No Master_SSL_CA_File : Master_SSL_CA_Path : Master_SSL_Cert : Master_SSL_Cipher : Master_SSL_Key : Seconds_Behind_Master : 0 Master_SSL_Verify_Server_Cert : No Last_IO_Errno : 0 Last_IO_Error : Last_SQL_Errno : 0 Last_SQL_Error :# ...done.

mysqlrplshow - Show Slaves for Master Server

SYNOPSIS

mysqlrplshow [options]

DESCRIPTION

This utility shows the replication slaves for a master. It prints a graph of the master and its slaves labelingeach with the host name and port number.

To explore the slaves for each client, use the --recurse option. This causes the utility to connect to eachslave found and attempt to determine whether it has any slaves. If slaves are found, the process continuesuntil the slave is found in the list of servers serving as masters (a circular topology). The graph displays thetopology with successive indents. A notation is made for circular topologies.

If you use the --recurse option, the utility attempts to connect to the slaves using the user name andpassword provided for the master. By default, if the connection attempt fails, the utility throws an error andstops. To change this behavior, use the --prompt option, which permits the utility to prompt for the username and password for each slave that fails to connect. You can also use the --num-retries=n optionto reattempt a failed connection ‘n’ times before the utility fails.

An example graph for a typical topology with relay slaves is shown here:

# Replication Topology Graph::

localhost:3311 (MASTER) | +--- localhost:3310 - (SLAVE) | +--- localhost:3312 - (SLAVE + MASTER) | +--- localhost:3313 - (SLAVE)

MASTER, SLAVE, and SLAVE+MASTER indicate that a server is a master only, slave only, and both slaveand master, respectively.

Page 285: MySQL Workbench

mysqlrplshow - Show Slaves for Master Server

277

A circular replication topology is shown like this, where <--> indicates circularity:

# Replication Topology Graph

localhost:3311 (MASTER) | +--- localhost:3312 - (SLAVE + MASTER) | +--- localhost:3313 - (SLAVE + MASTER) | +--- localhost:3311 <--> (SLAVE)

To produce a column list in addition to the graph, specify the --show-list option. In this case, to specifyhow to display the list, use one of the following values with the --format option:

• grid (default)

Display output in grid or table format like that of the mysql monitor.

• csv

Display output in comma-separated values format.

• tab

Display output in tab-separated format.

• vertical

Display output in single-column format like that of the \G command for the mysql monitor.

The utility uses of the SHOW SLAVE HOSTS statement to determine which slaves the master has. Ifyou want to use the --recurse option, slaves should have been started with the --report-host and--report-port options set to their actual host name and port number or the utility may not be able toconnect to the slaves to determine their own slaves.

OPTIONS

mysqlrplshow accepts the following command-line options:

• --help

Display a help message and exit.

• --format=<format>, -f<format>

Specify the display format for column list output. Permitted format values are grid, csv, tab, andvertical. The default is grid. This option applies only if --show-list is given.

• --master=<source>

Connection information for the master server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

• --max-depth=<N>

The maximum recursion depth. This option is valid only if --recurse is given.

• --num-retries=<num_retries>, -n<num_retries>

The number of retries permitted for failed slave login attempts. This option is valid only if --prompt isgiven.

Page 286: MySQL Workbench

mysqlrplshow - Show Slaves for Master Server

278

• --prompt, -p

Prompt for the slave user and password if different from the master user and password.

If you give this option, the utility sets --num-retries to 1 if that option is not set explicitly. This ensuresat least one attempt to retry and prompt for the user name and password should a connection fail.

• --quiet, -q

Turn off all messages for quiet execution. This option does not suppress errors or warnings.

• --recurse, -r

Traverse the list of slaves to find additional master/slave connections. User this option to map areplication topology.

• --show-list, -l

Display a column list of the topology.

• --version

Display version information and exit.

NOTES

The login user must have the REPLICATE SLAVE and REPLICATE CLIENT privileges to successfullyexecute this utility. Specifically, the login user must have appropriate permissions to execute SHOWSLAVE STATUS, SHOW MASTER STATUS, and SHOW SLAVE HOSTS.

For the --format option, the permitted values are not case sensitive. In addition, values may be specifiedas any unambiguous prefix of a valid value. For example, --format=g specifies the grid format. An erroroccurs if a prefix matches more than one valid value.

EXAMPLES

To show the slaves for a master running on port 3311 on the local host, use the following command:

$ mysqlrplshow --master=root@localhost:3311# master on localhost: ... connected.# Finding slaves for master: localhost:3311

# Replication Topology Graphlocalhost:3311 (MASTER) | +--- localhost:3310 - (SLAVE) | +--- localhost:3312 - (SLAVE)

As shown in the example, you must provide valid login information for the master.

To show the full replication topology of a master running on the local host, use the following command:

$ mysqlrplshow --master=root@localhost:3311 --recurse# master on localhost: ... connected.# Finding slaves for master: localhost:3311

# Replication Topology Graphlocalhost:3311 (MASTER) | +--- localhost:3310 - (SLAVE)

Page 287: MySQL Workbench

mysqlserverclone - Clone Existing Server to Create New Server

279

| +--- localhost:3312 - (SLAVE + MASTER) | +--- localhost:3313 - (SLAVE)

To show the full replication topology of a master running on the local host, prompting for the user nameand password for slaves that do not have the same user name and password credentials as the master,use the following command:

$ mysqlrplshow --recurse --prompt --num-retries=1 \ --master=root@localhost:3331

Server localhost:3331 is running on localhost.# master on localhost: ... connected.# Finding slaves for master: localhost:3331Server localhost:3332 is running on localhost.# master on localhost: ... FAILED.Connection to localhost:3332 has failed.Please enter the following information to connect to this server.User name: rootPassword:# master on localhost: ... connected.# Finding slaves for master: localhost:3332Server localhost:3333 is running on localhost.# master on localhost: ... FAILED.Connection to localhost:3333 has failed.Please enter the following information to connect to this server.User name: rootPassword:# master on localhost: ... connected.# Finding slaves for master: localhost:3333Server localhost:3334 is running on localhost.# master on localhost: ... FAILED.Connection to localhost:3334 has failed.Please enter the following information to connect to this server.User name: rootPassword:# master on localhost: ... connected.# Finding slaves for master: localhost:3334

# Replication Topology Graphlocalhost:3331 (MASTER) | +--- localhost:3332 - (SLAVE) | +--- localhost:3333 - (SLAVE + MASTER) | +--- localhost:3334 - (SLAVE)

mysqlserverclone - Clone Existing Server to Create New Server

SYNOPSIS

mysqlserverclone [options]

DESCRIPTION

This utility permits an administrator to clone an existing MySQL server instance to start a new serverinstance on the same host. The utility creates a new datadir (--new-data), and starts the server with asocket file. You can optionally add a password for the login user account on the new instance.

OPTIONS

mysqlserverclone accepts the following command-line options:

Page 288: MySQL Workbench

mysqlserverclone - Clone Existing Server to Create New Server

280

• --help

Display a help message and exit.

• --mysqld=<options>

Additional options for mysqld. To specify multiple options, separate them by spaces. Use appropriatequoting as necessary. For example, to specify --log-bin=binlog and --general-log-file="mylogfile", use:

--mysqld="--log-bin=binlog --general-log-file='my log file'"

• --new-data=<path_to_new_datadir>

The full path name of the location of the data directory for the new server instance. If the directory doesnot exist, the utility will create it.

• --new-id=<server_id>

The server_id value for the new server instance. The default is 2.

• --new-port=<port>

The port number for the new server instance. The default is 3307.

• --quiet, -q

Turn off all messages for quiet execution.

• --root-password=<password>

The password for the root user of the new server instance.

• --server=<source>

Connection information for the server to be cloned in <user>[:<passwd>]@<host>[:<port>][:<socket>]format.

• --verbose, -v

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug.

• --version

Display version information and exit.

• --write-command=<file_name>, -w<file_name>

Path name of file in which to write the command used to launch the new server instance.

EXAMPLES

The following command demonstrates how to create a new instance of a running server, set the root userpassword and enable binary logging:

$ mkdir /source/test123$ mysqlserverclone --server=root:pass@localhost \ --new-data=/Users/cbell/source/test123 --new-port=3310 \ --root-password=pass --mysqld=--log-bin=mysql-bin

Page 289: MySQL Workbench

mysqlserverinfo - Display Common Diagnostic Information from a Server

281

# Cloning the MySQL server running on localhost.# Creating new data directory...# Configuring new instance...# Locating mysql tools...# Setting up empty database and mysql tables...# Starting new instance of the server...# Testing connection to new instance...# Success!# Setting the root password...# ...done.

mysqlserverinfo - Display Common Diagnostic Information from a Server

SYNOPSIS

mysqlserverinfo [options]

DESCRIPTION

This utility displays critical information about a server for use in diagnosing problems. The informationdisplayed includes the following:

• Server connection information

• Server version number

• Data directory path name

• Base directory path name

• Plugin directory path name

• Configuration file location and name

• Current binary log coordinates (file name and position)

• Current relay log coordinates (file name and position)

This utility can be used to see the diagnostic information for servers that are running or offline. If you wantto see information about an offline server, the utility starts the server in read-only mode. In this case, youmust specify the --basedir, --datadir, and --start options to prevent the utility from starting anoffline server accidentally. Note: Be sure to consider the ramifications of starting an offline server on theerror and similar logs. It is best to save this information prior to running this utility.

To specify how to display output, use one of the following values with the --format option:

• grid (default)

Display output in grid or table format like that of the mysql monitor.

• csv

Display output in comma-separated values format.

• tab

Display output in tab-separated format.

• vertical

Display output in single-column format like that of the \G command for the mysql monitor.

Page 290: MySQL Workbench

mysqlserverinfo - Display Common Diagnostic Information from a Server

282

To turn off the headers for csv or tab display format, specify the --no-headers option.

To see the common default settings for the local server’s configuration file, use the --show-defaultsoption. This option reads the configuration file on the machine where the utility is run, not the machine forthe host that the --server option specifies.

To run the utility against several servers, specify the --server option multiple times. In this case, theutility attempts to connect to each server and read the information.

To see the MySQL servers running on the local machine, use the --show-servers option. This shows allthe servers with their process ID and data directory. On Windows, the utility shows only the process ID andport.

OPTIONS

mysqlserverinfo accepts the following command-line options:

• --help

Display a help message and exit.

• --basedir=<basedir>

The base directory for the server. This option is required for starting an offline server.

• --datadir=<datadir>

The data directory for the server. This option is required for starting an offline server.

• --format=<format>, -f<format>

Specify the output display format. Permitted format values are grid, csv, tab, and vertical. The default isgrid.

• --no-headers, -h

Do not display column headers. This option applies only for csv and tab output.

• --port-range=<start:end>

The port range to check for finding running servers. This option applies only to Windows and is ignoredunless --show-servers is given. The default range is 3306:3333.

• --server=<server>

Connection information for a server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format. Use thisoption multiple times to see information for multiple servers.

• --show-defaults, -d

Display default settings for mysqld from the local configuration file. It uses my_print_defaults toobtain the options.

• --show-servers

Display information about servers running on the local host. The utility examines the host process list todetermine which servers are running.

Page 291: MySQL Workbench

mysqluserclone - Clone Existing User to Create New User

283

• --start, -s

Start the server in read-only mode if it is offline. With this option, you must also give the --basedir and--datadir options.

• --verbose, -v

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug.

• --version

Display version information and exit.

For the --format option, the permitted values are not case sensitive. In addition, values may be specifiedas any unambiguous prefix of a valid value. For example, --format=g specifies the grid format. An erroroccurs if a prefix matches more than one valid value.

EXAMPLES

To display the server information for the local server and the settings for mysqld in the configuration filewith the output in a vertical list, use this command:

$ mysqlserverinfo --server=root:pass@localhost -d --format=vertical# Source on localhost: ... connected.************************* 1. row ************************* server: localhost:3306 version: 5.1.50-log datadir: /usr/local/mysql/data/ basedir: /usr/local/mysql-5.1.50-osx10.6-x86_64/ plugin_dir: /usr/local/mysql-5.1.50-osx10.6-x86_64/lib/plugin config_file: /etc/my.cnf binary_log: my_log.000068 binary_log_pos: 212383 relay_log: None relay_log_pos: None1 rows.

Defaults for server localhost:3306 --port=3306 --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --server_id=5 --log-bin=my_log --general_log --slow_query_log --innodb_data_file_path=ibdata1:778M;ibdata2:50M:autoextend#...done.

mysqluserclone - Clone Existing User to Create New User

SYNOPSIS

mysqluserclone [options] base_user new_user[:password][@host_name] ...

DESCRIPTION

This utility uses an existing MySQL user account on one server as a template, and clones it to create oneor more new user accounts with the same privileges as the original user. The new users can be created onthe original server or a different server.

Page 292: MySQL Workbench

mysqluserclone - Clone Existing User to Create New User

284

To list users for a server, specify the --list option. This prints a list of the users on the source (nodestination is needed). To control how to display list output, use one of the following values with the --format option:

• grid (default)

Display output in grid or table format like that of the mysql monitor.

• csv

Display output in comma-separated values format.

• tab

Display output in tab-separated format.

• vertical

Display output in single-column format like that of the \G command for the mysql monitor.

OPTIONS

mysqluserclone accepts the following command-line options:

• --help

Display a help message and exit.

• --destination=<destination>

Connection information for the destination server in <user>[:<passwd>]@<host>[:<port>][:<socket>]format.

• --dump, -d

Display the GRANT statements to create the account rather than executing them. In this case, the utilitydoes not connect to the destination server and no --destination option is needed.

• --format=<list_format>, -f<list_format>

Specify the user display format. Permitted format values are grid, csv, tab, and vertical. The default isgrid. This option is valid only if --list is given.

• --force

Drop the new user account if it exists before creating the new account. Without this option, it is an errorto try to create an account that already exists.

• --include-global-privileges

Include privileges that match base_user@% as well as base_user@host.

• --list

List all users on the source server. With this option, a destination server need not be specified.

• --quiet, -q

Turn off all messages for quiet execution.

Page 293: MySQL Workbench

Parsers

285

• --source=<source>

Connection information for the source server in <user>[:<passwd>]@<host>[:<port>][:<socket>] format.

• --verbose, -v

Specify how much information to display. Use this option multiple times to increase the amount ofinformation. For example, -v = verbose, -vv = more verbose, -vvv = debug.

• --version

Display version information and exit.

NOTES

You must provide connection parameters (user, host, password, and so forth) for an account that has theappropriate privileges to access all objects in the operation.

The account used to connect to the source server must have privileges to read the mysql database.

The account used to connect to the destination server must have privileges to execute CREATE USER(and DROP USER if the --force option is given), and privileges to execute GRANT for all privileges to begranted to the new accounts.

For the --format option, the permitted values are not case sensitive. In addition, values may be specifiedas any unambiguous prefix of a valid value. For example, --format=g specifies the grid format. An erroroccurs if a prefix matches more than one valid value.

EXAMPLES

To clone joe as sam and sally with passwords and logging in as root on the local machine, use thiscommand:

$ mysqluserclone --source=root@localhost \ --destination=root@localhost \ joe@localhost sam:secret1@localhost sally:secret2@localhost# Source on localhost: ... connected.# Destination on localhost: ... connected.# Cloning 2 users...# Cloning joe@localhost to user sam:secret1@localhost# Cloning joe@localhost to user sally:secret2@localhost# ...done.

The following command shows all users on the local server in the most verbose output in CSV format:

$ mysqluserclone --source=root@localhost --list --format=csv -vvv# Source on localhost: ... connected.user,host,databasejoe,localhost,util_testrpl,localhost,sally,localhost,util_testsam,localhost,util_testjoe,user,util_test

Parsers

mysql.utilities.parser — Parse MySQL Log Files

This module provides classes for parsing MySQL log files. Currently, Slow Query Log and General QueryLog are supported.

Page 294: MySQL Workbench

mysql.utilities.parser — Parse MySQL Log Files

286

Classes

class mysql.utilities.parser.GeneralQueryLog(stream)

This class parses the MySQL General Query Log. Instances are iterable, but the class does not providemultiple independent iterators.

For example, to read the log and print the entries:

>>> general_log = open("/var/lib/mysql/mysql.log")>>> log = GeneralQueryLog(general_log)>>> for entry in log:... print entry

Parameters: • stream (file type) – a valid file type; for example,the result of the built-in Python function open()

version

Returns: Version of the MySQL server that produced the log

Return type: tuple

program

Returns: Full path of the MySQL server executable

Return type: str

port

Returns: TCP/IP port on which the MySQL server waslistening

Return type: int

socket

Returns: Full path of the MySQL server Unix socket

Return type: str

start_datetime

Returns: Date and time of the first read log entry

Return type: datetime.datetime

lastseen_datetime

Returns: Date and time of the last read log entry

Return type: datetime.datetime

class mysql.utilities.parser.SlowQueryLog(stream)

This class parses the MySQL Slow Query Log. Instances are iterable, but the class does not providemultiple independent iterators.

Page 295: MySQL Workbench

mysql.utilities.parser — Parse MySQL Log Files

287

For example, to read the log and print the entries:

>>> slow_log = open("/var/lib/mysql/mysql-slow.log")>>> log = SlowQueryLog(slow_log)>>> for entry in log:... print entry

Parameters: • stream (file type) – a valid file type; for example,the result of the built-in Python function open()

version

Returns: Version of the MySQL server that produced the log

Return type: tuple

program

Returns: Full path of the MySQL server executable

Return type: str

port

Returns: TCP/IP port on which the MySQL server waslistening

Return type: int

socket

Returns: Full path of the MySQL server Unix socket

Return type: str

start_datetime

Returns: Date and time of the first read log entry

Return type: datetime.datetime

lastseen_datetime

Returns: Date and time of the last read log entry

Return type: datetime.datetime

Page 296: MySQL Workbench

288

Page 297: MySQL Workbench

289

Appendix A. Third Party Licenses

Table of Contents.NET Flat TabControl License ......................................................................................................... 290ANTLR 3.4 License ........................................................................................................................ 290Bitstream Vera License .................................................................................................................. 291Boost Library License ..................................................................................................................... 292Cairo License ................................................................................................................................. 292CTemplate (Google Template System) License ............................................................................... 293cURL (libcurl) License ............................................................................................................... 293DockPanel Suite License ................................................................................................................ 294Dojo Toolkit v1.7.0b1 License ......................................................................................................... 294GLib License (for MySQL Workbench) ............................................................................................ 295Glitz License .................................................................................................................................. 295GNU Lesser General Public License Version 2.1, February 1999 ...................................................... 296HtmlRenderer (System.Drawing.Html) ............................................................................................. 304Libiconv License ............................................................................................................................ 304Libintl License ................................................................................................................................ 305Libxml2 License ............................................................................................................................. 305Libzip License ................................................................................................................................ 306Lua (liblua) License ........................................................................................................................ 306Paramiko License .......................................................................................................................... 307PCRE License ............................................................................................................................... 307Pixman License ............................................................................................................................. 308PyCrypto License ........................................................................................................................... 310Python License .............................................................................................................................. 310Scintilla License ............................................................................................................................. 320ScintillaNET License ...................................................................................................................... 322TinyXML License ........................................................................................................................... 322TreeViewAdv for .NET License ....................................................................................................... 323VSQLite++ License ........................................................................................................................ 323zlib License ................................................................................................................................ 324

Use of any of this software is governed by the terms of the licenses that follow.

MySQL Workbench

• .NET Flat TabControl License

• ANTLR 3.4 License

• Bitstream Vera License

• Boost Library License

• Cairo License

• CTemplate (Google Template System) License

• cURL (libcurl) License

• DockPanel Suite License

Page 298: MySQL Workbench

.NET Flat TabControl License

290

• Dojo Toolkit v1.7.0b1 License

• GLib License (for MySQL Workbench)

• Glitz License

• GNU Lesser General Public License Version 2.1, February 1999

• HtmlRenderer (System.Drawing.Html)

• Libiconv License

• Libintl License

• Libxml2 License

• Libzip License

• Lua (liblua) License

• Paramiko License

• PCRE License

• Pixman License

• PyCrypto License

• Python License

• Scintilla License

• ScintillaNET License

• TinyXML License

• TreeViewAdv for .NET License

• VSQLite++ License

• zlib License

.NET Flat TabControl LicenseThe following software may be included in this product:

• .NET Flat TabControl

Use of any of this software is governed by the terms of the license below:

It is free. Public domain!Oscar Londono

ANTLR 3.4 LicenseThe following software may be included in this product:

ANTLR 3.4

This product was build using ANTLR, which was provided to Oracle under the

Page 299: MySQL Workbench

Bitstream Vera License

291

following terms:

Copyright (c) 2010 Terence Parr All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Bitstream Vera License

The following software may be included in this product:

Bitstream Vera

Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademarkof Bitstream, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions:

The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces.

The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing either the words "Bitstream" or the word "Vera".

This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Bitstream Vera" names.

The Font Software may be sold as part of a larger

Page 300: MySQL Workbench

Boost Library License

292

software package but no copy of one or more of the Font Software typefaces may be sold by itself.

THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.

Except as contained in this notice, the names of Gnome, the Gnome Foundation, and Bitstream Inc., shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written authorization from the Gnome Foundation or Bitstream Inc., respectively. For further information, contact: fonts at gnome dot org.

Boost Library License

The following software may be included in this product:

Boost C++ Libraries

Use of any of this software is governed by the terms of the license below:

Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person ororganization obtaining a copy of the software and accompanyingdocumentation covered by this license (the "Software") to use,reproduce, display, distribute, execute, and transmit the Software,and to prepare derivative works of the Software, and to permitthird-parties to whom the Software is furnished to do so, allsubject to the following:

The copyright notices in the Software and this entire statement,including the above license grant, this restriction and thefollowing disclaimer, must be included in all copies of theSoftware, in whole or in part, and all derivative works of theSoftware, unless such copies or derivative works are solely in theform of machine-executable object code generated by a sourcelanguage processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE ANDNON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONEDISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHERLIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUTOF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGSIN THE SOFTWARE.

Cairo License

The following software may be included in this product:

Cairo

Page 301: MySQL Workbench

CTemplate (Google Template System) License

293

You are receiving a copy of the Cairo in both source and object code in the following DLL (libcairo.dll) or dynamic libraries (MySQLWorkbench.app/Contents/Frameworks/libcairo.2.dylib and MySQLWorkbench.app/Contents/Frameworks/libpixman-1.0.dylib). The terms of the Oracle license do NOT apply to Cairo; Oracle distributes it under the GNU Lesser General Public License Version 2.1 separately from the Oracle programs you receive. You can also separately obtain and use Cairo independent of the Oracle programs under a dual license subject to the terms of the LGPL or the Mozilla Public License Version 1.1. If you do not wish to install this program, you may delete libcairo.dll or libcairo.2.dylib and libpixman-1.0.dylib from the installation directoryor uninstall MySQL Workbench completely.

This component is licensed under GNU Lesser General Public License Version 2.1, February 1999.

CTemplate (Google Template System) LicenseThe following software may be included in this product:

CTemplate (Google Template System)

Copyright (c) 2005, Google Inc.All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER INCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

cURL (libcurl) LicenseThe following software may be included in this product:

cURL (libcurl)

Page 302: MySQL Workbench

DockPanel Suite License

294

Use of any of this software is governed by the terms of the license below:

COPYRIGHT AND PERMISSION NOTICE

Copyright (c) 1996 - 2009, Daniel Stenberg, <[email protected]>.All rights reserved.

Permission to use, copy, modify, and distribute this software for any purposewith or without fee is hereby granted, provided that the above copyrightnotice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of a copyright holder shall notbe used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder.

DockPanel Suite LicenseThe following software may be included in this product:

DockPanel Suite

The MIT License

Copyright (c) 2007 Weifen Luo (email: [email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Dojo Toolkit v1.7.0b1 LicenseThe following software may be included in this product:

Dojo Toolkit v1.7.0b1Copyright (c) 2005-2006, The Dojo Foundation

Page 303: MySQL Workbench

GLib License (for MySQL Workbench)

295

All rights reserved.

Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditionsare met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.* Neither the name of the Dojo Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOTLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESSFOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THECOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVERCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICTLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING INANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF SUCH DAMAGE.

GLib License (for MySQL Workbench)

The following software may be included in this product:

GLib

You are receiving a copy of the GLib library in both source andobject code in the following folder: C:\Program Files(x86)\MySQL\MySQLWorkbench 5.2\ on Windows andMySQLWorkbench.app/Contents/Frameworks on Mac OS X. The terms ofthe Oracle license do NOT apply to the GLib library; it is licensedunder the following license, separately from the Oracle programsyou receive. If you do not wish to install this library, you maygo to the folder C:\Program Files (x86)\MySQL\MySQL Workbench 5.2\and remove or replace the libglib-2.0-0.dll, libgmodule-2.0-0.dll,libgobject-2.0-0.dll and libgthread-2.0-0.dll files if present onWindows or go to the folder MySQLWorkbench.app/Contents/Frameworksand remove or replace the files libglib-2.*.dylib, libgmodule-2.*.dyliband libgthread-2.*.dylib on Mac OS X, but the Oracle program mightnot operate properly or at all without the library.

This component is licensed under GNU Lesser General Public License Version 2.1, February 1999.

Glitz License

The following software may be included in this product:

Glitz

Copyright © 2004 David Reveman, Peter Nilsson

Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above

Page 304: MySQL Workbench

GNU Lesser General Public License Version 2.1, February 1999

296

copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names ofDavid Reveman and Peter Nilsson not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. David Reveman and Peter Nilsson makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.

DAVID REVEMAN AND PETER NILSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DAVID REVEMAN AND PETER NILSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGESWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHERTORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

GNU Lesser General Public License Version 2.1, February 1999The following applies to all products licensed under the GNU Lesser General Public License, Version 2.1: You may not use the identified files except in compliance with the GNU Lesser General Public License, Version 2.1 (the "License"). You may obtain a copy of the License athttp://www.gnu.org/licenses/lgpl-2.1.html. A copy of the license is also reproduced below. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governingpermissions and limitations under the License.

GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999

Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.]

Preamble

The licenses for most software are designed to take away yourfreedom to share and change it. By contrast, the GNU General PublicLicenses are intended to guarantee your freedom to share and changefree software--to make sure the software is free for all its users.

This license, the Lesser General Public License, applies to somespecially designated software packages--typically libraries--of theFree Software Foundation and other authors who decide to use it. Youcan use it too, but we suggest you first think carefully about whetherthis license or the ordinary General Public License is the betterstrategy to use in any particular case, based on the explanations below.

When we speak of free software, we are referring to freedom of use,not price. Our General Public Licenses are designed to make sure thatyou have the freedom to distribute copies of free software (and chargefor this service if you wish); that you receive source code or can getit if you want it; that you can change the software and use pieces of

Page 305: MySQL Workbench

GNU Lesser General Public License Version 2.1, February 1999

297

it in new free programs; and that you are informed that you can dothese things.

To protect your rights, we need to make restrictions that forbiddistributors to deny you these rights or to ask you to surrender theserights. These restrictions translate to certain responsibilities foryou if you distribute copies of the library or if you modify it.

For example, if you distribute copies of the library, whether gratisor for a fee, you must give the recipients all the rights that we gaveyou. You must make sure that they, too, receive or can get the sourcecode. If you link other code with the library, you must providecomplete object files to the recipients, so that they can relink themwith the library after making changes to the library and recompilingit. And you must show them these terms so they know their rights.

We protect your rights with a two-step method: (1) we copyright thelibrary, and (2) we offer you this license, which gives you legalpermission to copy, distribute and/or modify the library.

To protect each distributor, we want to make it very clear thatthere is no warranty for the free library. Also, if the library ismodified by someone else and passed on, the recipients should knowthat what they have is not the original version, so that the originalauthor's reputation will not be affected by problems that might beintroduced by others.

Finally, software patents pose a constant threat to the existence ofany free program. We wish to make sure that a company cannoteffectively restrict the users of a free program by obtaining arestrictive license from a patent holder. Therefore, we insist thatany patent license obtained for a version of the library must beconsistent with the full freedom of use specified in this license.

Most GNU software, including some libraries, is covered by theordinary GNU General Public License. This license, the GNU LesserGeneral Public License, applies to certain designated libraries, andis quite different from the ordinary General Public License. We usethis license for certain libraries in order to permit linking thoselibraries into non-free programs.

When a program is linked with a library, whether statically or usinga shared library, the combination of the two is legally speaking acombined work, a derivative of the original library. The ordinaryGeneral Public License therefore permits such linking only if theentire combination fits its criteria of freedom. The Lesser GeneralPublic License permits more lax criteria for linking other code withthe library.

We call this license the "Lesser" General Public License because itdoes Less to protect the user's freedom than the ordinary GeneralPublic License. It also provides other free software developers Lessof an advantage over competing non-free programs. These disadvantagesare the reason we use the ordinary General Public License for manylibraries. However, the Lesser license provides advantages in certainspecial circumstances.

For example, on rare occasions, there may be a special need toencourage the widest possible use of a certain library, so that itbecomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.

In other cases, permission to use a particular library in non-freeprograms enables a greater number of people to use a large body of

Page 306: MySQL Workbench

GNU Lesser General Public License Version 2.1, February 1999

298

free software. For example, permission to use the GNU C Library innon-free programs enables many more people to use the whole GNUoperating system, as well as its variant, the GNU/Linux operatingsystem.

Although the Lesser General Public License is Less protective of theusers' freedom, it does ensure that the user of a program that islinked with the Library has the freedom and the wherewithal to runthat program using a modified version of the Library.

The precise terms and conditions for copying, distribution andmodification follow. Pay close attention to the difference between a"work based on the library" and a "work that uses the library". Theformer contains code derived from the library, whereas the latter mustbe combined with the library in order to run.

GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License Agreement applies to any software library or otherprogram which contains a notice placed by the copyright holder orother authorized party saying it may be distributed under the terms ofthis Lesser General Public License (also called "this License").Each licensee is addressed as "you".

A "library" means a collection of software functions and/or dataprepared so as to be conveniently linked with application programs(which use some of those functions and data) to form executables.

The "Library", below, refers to any such software library or workwhich has been distributed under these terms. A "work based on theLibrary" means either the Library or any derivative work undercopyright law: that is to say, a work containing the Library or aportion of it, either verbatim or with modifications and/or translatedstraightforwardly into another language. (Hereinafter, translation isincluded without limitation in the term "modification".)

"Source code" for a work means the preferred form of the work formaking modifications to it. For a library, complete source code meansall the source code for all modules it contains, plus any associatedinterface definition files, plus the scripts used to controlcompilation and installation of the library.

Activities other than copying, distribution and modification are notcovered by this License; they are outside its scope. The act ofrunning a program using the Library is not restricted, and output fromsuch a program is covered only if its contents constitute a work basedon the Library (independent of the use of the Library in a tool forwriting it). Whether that is true depends on what the Library doesand what the program that uses the Library does.

1. You may copy and distribute verbatim copies of the Library'scomplete source code as you receive it, in any medium, provided thatyou conspicuously and appropriately publish on each copy anappropriate copyright notice and disclaimer of warranty; keep intactall the notices that refer to this License and to the absence of anywarranty; and distribute a copy of this License along with theLibrary.

You may charge a fee for the physical act of transferring a copy,and you may at your option offer warranty protection in exchange for afee.

2. You may modify your copy or copies of the Library or any portionof it, thus forming a work based on the Library, and copy anddistribute such modifications or work under the terms of Section 1above, provided that you also meet all of these conditions:

Page 307: MySQL Workbench

GNU Lesser General Public License Version 2.1, February 1999

299

a) The modified work must itself be a software library.

b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.

c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.

d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.

(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)

These requirements apply to the modified work as a whole. Ifidentifiable sections of that work are not derived from the Library,and can be reasonably considered independent and separate works inthemselves, then this License, and its terms, do not apply to thosesections when you distribute them as separate works. But when youdistribute the same sections as part of a whole which is a work basedon the Library, the distribution of the whole must be on the terms ofthis License, whose permissions for other licensees extend to theentire whole, and thus to each and every part regardless of who wroteit.

Thus, it is not the intent of this section to claim rights or contestyour rights to work written entirely by you; rather, the intent is toexercise the right to control the distribution of derivative orcollective works based on the Library.

In addition, mere aggregation of another work not based on the Librarywith the Library (or with a work based on the Library) on a volume ofa storage or distribution medium does not bring the other work underthe scope of this License.

3. You may opt to apply the terms of the ordinary GNU General PublicLicense instead of this License to a given copy of the Library. To dothis, you must alter all the notices that refer to this License, sothat they refer to the ordinary GNU General Public License, version 2,instead of to this License. (If a newer version than version 2 of theordinary GNU General Public License has appeared, then you can specifythat version instead if you wish.) Do not make any other change inthese notices.

Once this change is made in a given copy, it is irreversible forthat copy, so the ordinary GNU General Public License applies to allsubsequent copies and derivative works made from that copy.

This option is useful when you wish to copy part of the code ofthe Library into a program that is not a library.

4. You may copy and distribute the Library (or a portion orderivative of it, under Section 2) in object code or executable formunder the terms of Sections 1 and 2 above provided that you accompanyit with the complete corresponding machine-readable source code, whichmust be distributed under the terms of Sections 1 and 2 above on amedium customarily used for software interchange.

Page 308: MySQL Workbench

GNU Lesser General Public License Version 2.1, February 1999

300

If distribution of object code is made by offering access to copyfrom a designated place, then offering equivalent access to copy thesource code from the same place satisfies the requirement todistribute the source code, even though third parties are notcompelled to copy the source along with the object code.

5. A program that contains no derivative of any portion of theLibrary, but is designed to work with the Library by being compiled orlinked with it, is called a "work that uses the Library". Such awork, in isolation, is not a derivative work of the Library, andtherefore falls outside the scope of this License.

However, linking a "work that uses the Library" with the Librarycreates an executable that is a derivative of the Library (because itcontains portions of the Library), rather than a "work that uses thelibrary". The executable is therefore covered by this License.Section 6 states terms for distribution of such executables.

When a "work that uses the Library" uses material from a header filethat is part of the Library, the object code for the work may be aderivative work of the Library even though the source code is not.Whether this is true is especially significant if the work can belinked without the Library, or if the work is itself a library. Thethreshold for this to be true is not precisely defined by law.

If such an object file uses only numerical parameters, datastructure layouts and accessors, and small macros and small inlinefunctions (ten lines or less in length), then the use of the objectfile is unrestricted, regardless of whether it is legally a derivativework. (Executables containing this object code plus portions of theLibrary will still fall under Section 6.)

Otherwise, if the work is a derivative of the Library, you maydistribute the object code for the work under the terms of Section 6.Any executables containing that work also fall under Section 6,whether or not they are linked directly with the Library itself.

6. As an exception to the Sections above, you may also combine orlink a "work that uses the Library" with the Library to produce awork containing portions of the Library, and distribute that workunder terms of your choice, provided that the terms permitmodification of the work for the customer's own use and reverseengineering for debugging such modifications.

You must give prominent notice with each copy of the work that theLibrary is used in it and that the Library and its use are covered bythis License. You must supply a copy of this License. If the workduring execution displays copyright notices, you must include thecopyright notice for the Library among them, as well as a referencedirecting the user to the copy of this License. Also, you must do oneof these things:

a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)

b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a

Page 309: MySQL Workbench

GNU Lesser General Public License Version 2.1, February 1999

301

copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.

c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.

d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.

e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy.

For an executable, the required form of the "work that uses theLibrary" must include any data and utility programs needed forreproducing the executable from it. However, as a special exception,the materials to be distributed need not include anything that isnormally distributed (in either source or binary form) with the majorcomponents (compiler, kernel, and so on) of the operating system onwhich the executable runs, unless that component itself accompaniesthe executable.

It may happen that this requirement contradicts the licenserestrictions of other proprietary libraries that do not normallyaccompany the operating system. Such a contradiction means you cannotuse both them and the Library together in an executable that youdistribute.

7. You may place library facilities that are a work based on theLibrary side-by-side in a single library together with other libraryfacilities not covered by this License, and distribute such a combinedlibrary, provided that the separate distribution of the work based onthe Library and of the other library facilities is otherwisepermitted, and provided that you do these two things:

a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.

b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.

8. You may not copy, modify, sublicense, link with, or distributethe Library except as expressly provided under this License. Anyattempt otherwise to copy, modify, sublicense, link with, ordistribute the Library is void, and will automatically terminate yourrights under this License. However, parties who have received copies,or rights, from you under this License will not have their licensesterminated so long as such parties remain in full compliance.

9. You are not required to accept this License, since you have notsigned it. However, nothing else grants you permission to modify ordistribute the Library or its derivative works. These actions areprohibited by law if you do not accept this License. Therefore, bymodifying or distributing the Library (or any work based on theLibrary), you indicate your acceptance of this License to do so, andall its terms and conditions for copying, distributing or modifyingthe Library or works based on it.

10. Each time you redistribute the Library (or any work based on the

Page 310: MySQL Workbench

GNU Lesser General Public License Version 2.1, February 1999

302

Library), the recipient automatically receives a license from theoriginal licensor to copy, distribute, link with or modify the Librarysubject to these terms and conditions. You may not impose any furtherrestrictions on the recipients' exercise of the rights granted herein.You are not responsible for enforcing compliance by third parties withthis License.

11. If, as a consequence of a court judgment or allegation of patentinfringement or for any other reason (not limited to patent issues),conditions are imposed on you (whether by court order, agreement orotherwise) that contradict the conditions of this License, they do notexcuse you from the conditions of this License. If you cannotdistribute so as to satisfy simultaneously your obligations under thisLicense and any other pertinent obligations, then as a consequence youmay not distribute the Library at all. For example, if a patentlicense would not permit royalty-free redistribution of the Library byall those who receive copies directly or indirectly through you, thenthe only way you could satisfy both it and this License would be torefrain entirely from distribution of the Library.

If any portion of this section is held invalid or unenforceable underany particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in othercircumstances.

It is not the purpose of this section to induce you to infringe anypatents or other property right claims or to contest validity of anysuch claims; this section has the sole purpose of protecting theintegrity of the free software distribution system which isimplemented by public license practices. Many people have madegenerous contributions to the wide range of software distributedthrough that system in reliance on consistent application of thatsystem; it is up to the author/donor to decide if he or she is willingto distribute software through any other system and a licensee cannotimpose that choice.

This section is intended to make thoroughly clear what is believed tobe a consequence of the rest of this License.

12. If the distribution and/or use of the Library is restricted incertain countries either by patents or by copyrighted interfaces, theoriginal copyright holder who places the Library under this License may add an explicit geographical distribution limitation excludingthose countries, so that distribution is permitted only in or amongcountries not thus excluded. In such case, this License incorporatesthe limitation as if written in the body of this License.

13. The Free Software Foundation may publish revised and/or newversions of the Lesser General Public License from time to time.Such new versions will be similar in spirit to the present version,but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Libraryspecifies a version number of this License which applies to it and"any later version", you have the option of following the terms andconditions either of that version or of any later version published bythe Free Software Foundation. If the Library does not specify alicense version number, you may choose any version ever published bythe Free Software Foundation.

14. If you wish to incorporate parts of the Library into other freeprograms whose distribution conditions are incompatible with these,write to the author to ask for permission. For software which iscopyrighted by the Free Software Foundation, write to the FreeSoftware Foundation; we sometimes make exceptions for this. Ourdecision will be guided by the two goals of preserving the free statusof all derivatives of our free software and of promoting the sharing

Page 311: MySQL Workbench

GNU Lesser General Public License Version 2.1, February 1999

303

and reuse of software generally.

NO WARRANTY

15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NOWARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OROTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANYKIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULARPURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THELIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUMETHE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO INWRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFYAND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOUFOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL ORCONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THELIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEINGRENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR AFAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IFSUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCHDAMAGES.

END OF TERMS AND CONDITIONS

How to Apply These Terms to Your New Libraries

If you develop a new library, and you want it to be of the greatestpossible use to the public, we recommend making it free software thateveryone can redistribute and change. You can do so by permittingredistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).

To apply these terms, attach the following notices to the library.It is safest to attach them to the start of each source file to mosteffectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the fullnotice is found.

<one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author>

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Also add information on how to contact you by electronic and paper mail.

You should also get your employer (if you work as a programmer) or yourschool, if any, to sign a "copyright disclaimer" for the library, ifnecessary. Here is a sample; alter the names:

Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James

Page 312: MySQL Workbench

HtmlRenderer (System.Drawing.Html)

304

Random Hacker.

<signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice

That's all there is to it!

HtmlRenderer (System.Drawing.Html)

The following software may be included in this product:

HtmlRenderer (System.Drawing.Html)

Copyright (c) 2009, José Manuel Menéndez PooAll rights reserved.

Redistribution and use in source and binary forms,with or without modification, are permitted providedthat the following conditions are met:

* Redistributions of source code must retain theabove copyright notice, this list of conditionsand the following disclaimer.

* Redistributions in binary form must reproducethe above copyright notice, this list of conditionsand the following disclaimer in the documentationand/or other materials provided with the distribution.

* Neither the name of menendezpoo.com nor the namesof its contributors may be used to endorse or promoteproducts derived from this software without specificprior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERSAND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIEDWARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESSFOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENTSHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLEFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITEDTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSSOF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDINGNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OFTHE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF SUCH DAMAGE.

Libiconv License

The following software may be included in this product:

Libiconv

You are receiving a copy of the GNU LIBICONV Library. The terms of the Oracle license do NOT apply to the GNU LIBICONV Library; it is licensed under the following license, separately from the Oracle programs you receive. If you do not wish to install this program, you may delete iconv.dll or libiconv.* files.

This component is licensed under GNU Lesser General Public License Version 2.1, February 1999.

Page 313: MySQL Workbench

Libintl License

305

Libintl LicenseThe following software may be included in this product:

libintl

Copyright (C) 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. FSF changes to this file are in the public domain.

Copyright 1996-2007 Free Software Foundation, Inc. Taken from GNU libtool, 2001

Originally by Gordon Matzigkeit <[email protected]>, 1996

This file is free software; the Free Software Foundation gives unlimited permission to copy and/or distribute it, with or without modifications, as long as this notice is preserved.

You are receiving a copy of the libintl library. The terms of the Oracle license do NOT apply to the libintl library; it is licensed under the following license, separately from the Oracle programs you receive. If you do not wish to install this program, you may delete the intl.dll or libintl.* files.

This component is licensed under GNU Lesser General Public License Version 2.1, February 1999.

Libxml2 LicenseThe following software may be included in this product:

Libxml2

Except where otherwise noted in the source code (e.g. the files hash.c, list.c and the trio files, which are covered by a similar licence but with different Copyright notices) all the files are:

Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,

Page 314: MySQL Workbench

Libzip License

306

sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of Daniel Veillard shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from him.

Libzip LicenseThe following software may be included in this product:

libzip

Copyright (C) 1999-2008 Dieter Baron and Thomas KlausnerThe authors can be contacted at <[email protected]>

Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditionsare met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESSOR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSEARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIALDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTEGOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESSINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OROTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVENIF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Lua (liblua) LicenseThe following software may be included in this product:

Lua (liblua)

Page 315: MySQL Workbench

Paramiko License

307

Copyright © 1994–2008 Lua.org, PUC-Rio.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Paramiko LicenseThe following software may be included in this product:

Paramiko

You are receiving a copy of Paramiko in both source and object code. The terms of the Oracle license do NOT apply to the Paramiko program; it is licensed under the following license, separately from the Oracle programs you receive. If you do not wish to install this program, you may delete the Paramiko folder and all its contents.

This component is licensed under GNU Lesser General Public License Version 2.1, February 1999.

PCRE LicenseThe following software may be included in this product:

PCRE (Perl Compatible Regular Expressions) Library

PCRE LICENCE

PCRE is a library of functions to support regular expressions whose syntax and semantics are as close as possible to those of the Perl 5 language.

Release 7 of PCRE is distributed under the terms of the "BSD" licence, as specified below. The documentation for PCRE, supplied in the "doc" directory, is distributed under the same terms as the software itself.

The basic library functions are written in C and are freestanding. Also included in the distribution is a set of C++ wrapper functions.

THE BASIC LIBRARY FUNCTIONS---------------------------Written by: Philip HazelEmail local part: ph10Email domain: cam.ac.uk

University of Cambridge Computing Service,Cambridge, England. Phone: +44 1223 334714.

Page 316: MySQL Workbench

Pixman License

308

Copyright (c) 1997-2006 University of CambridgeAll rights reserved.

THE C++ WRAPPER FUNCTIONS-------------------------Contributed by: Google Inc.

Copyright (c) 2006, Google Inc.All rights reserved.

THE "BSD" LICENCE-----------------

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.* Neither the name of the University of Cambridge nor the name of Google Inc. nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

End

Pixman License

The following software may be included in this product:

Pixman

Pixman v0.21.2The following is the MIT license, agreed upon by most contributors. Copyright holders of new code should use this license statement where possible. They may also add themselves to the list below.

Copyright 1987, 1988, 1989, 1998 The Open Group Copyright 1987, 1988, 1989 Digital Equipment Corporation Copyright 1999, 2004, 2008 Keith Packard Copyright 2000 SuSE, Inc. Copyright 2000 Keith Packard, member of The XFree86 Project, Inc. Copyright 2004, 2005, 2007, 2008, 2009, 2010 Red Hat, Inc. Copyright 2004 Nicholas Miell Copyright 2005 Lars Knoll & Zack Rusin, Trolltech Copyright 2005 Trolltech AS

Page 317: MySQL Workbench

Pixman License

309

Copyright 2007 Luca Barbato Copyright 2008 Aaron Plattner, NVIDIA Corporation Copyright 2008 Rodrigo Kumpera Copyright 2008 André Tupinambá Copyright 2008 Mozilla Corporation Copyright 2008 Frederic Plourde Copyright 2009, Oracle and/or its affiliates. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Pixman v0.17.4 and lower:The following is the 'standard copyright' agreed upon by most contributors, and is currently the canonical icense, though a modification is currently under discussion. Copyright holders of new code should use this license statement where possible, and append their name to this list.

Copyright 1987, 1988, 1989, 1998 The Open GroupCopyright 1987, 1988, 1989 Digital Equipment CorporationCopyright 1999, 2004, 2008 Keith PackardCopyright 2000 SuSE, Inc.Copyright 2000 Keith Packard, member of The XFree86 Project, Inc.Copyright 2004, 2005, 2007, 2008 Red Hat, Inc.Copyright 2004 Nicholas MiellCopyright 2005 Lars Knoll & Zack Rusin, TrolltechCopyright 2005 Trolltech ASCopyright 2007 Luca BarbatoCopyright 2008 Aaron Plattner, NVIDIA CorporationCopyright 2008 Rodrigo KumperaCopyright 2008 André TupinambáCopyright 2008 Mozilla CorporationCopyright 2008 Frederic PlourdeCopyright 2009 Sun Microsystems, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice

Page 318: MySQL Workbench

PyCrypto License

310

(including the next paragraph) shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

PyCrypto LicenseThe following software may be included in this product:

PyCrypto - The Python Cryptography Toolkit

=================================================================== Distribute and use freely; there are no restrictions on further dissemination and usage except those imposed by the laws of your country of residence. This software is provided "as is" without warranty of fitness for use or suitability for any purpose, express or implied. Use at your own risk or not at all. ===================================================================

Incorporating the code into commercial products is permitted; you do not have to make source available or contribute your changes back (though that would be nice).

--amk (www.amk.ca)

/********************************************************************\ * FILE: rmd160.c * CONTENTS: A sample C-implementation of the RIPEMD-160 hash-function. * TARGET: any computer with an ANSI C compiler * AUTHOR: Antoon Bosselaers, Dept. Electrical Eng.-ESAT/COSIC * DATE: 1 March 1996 VERSION: 1.0 ********************************************************************** * Copyright (c) Katholieke Universiteit Leuven 1996, All Rights Reserved * The Katholieke Universiteit Leuven makes no representations concerning * either the merchantability of this software or the suitability of this * software for any particular purpose. It is provided "as is" without * express or implied warranty of any kind. These notices must be retained * in any copies of any part of this documentation and/or software. \********************************************************************/

Python LicenseThe following software may be included in this product:

Python Programming Language

This is the official license for the Python 2.7 release:

A. HISTORY OF THE SOFTWAREPython was created in the early 1990s by Guido van Rossum at StichtingMathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlandsas a successor of a language called ABC. Guido remains Python'sprincipal author, although it includes many contributions from others.

In 1995, Guido continued his work on Python at the Corporation forNational Research Initiatives (CNRI, see http://www.cnri.reston.va.us)

Page 319: MySQL Workbench

Python License

311

in Reston, Virginia where he released several versions of thesoftware.

In May 2000, Guido and the Python core development team moved toBeOpen.com to form the BeOpen PythonLabs team. In October of the sameyear, the PythonLabs team moved to Digital Creations (now ZopeCorporation, see http://www.zope.com). In 2001, the Python SoftwareFoundation (PSF, see http://www.python.org/psf/) was formed, anon-profit organization created specifically to own Python-relatedIntellectual Property. Zope Corporation is a sponsoring member ofthe PSF.

All Python releases are Open Source (see http://www.opensource.org forthe Open Source Definition). Historically, most, but not all, Pythonreleases have also been GPL-compatible; the table below summarizesthe various releases.

Release Derived Year Owner GPL- from compatible? (1)

0.9.0 thru 1.2 1991-1995 CWI yes 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes 1.6 1.5.2 2000 CNRI no 2.0 1.6 2000 BeOpen.com no 1.6.1 1.6 2001 CNRI yes (2) 2.1 2.0+1.6.1 2001 PSF no 2.0.1 2.0+1.6.1 2001 PSF yes 2.1.1 2.1+2.0.1 2001 PSF yes 2.2 2.1.1 2001 PSF yes 2.1.2 2.1.1 2002 PSF yes 2.1.3 2.1.2 2002 PSF yes 2.2.1 2.2 2002 PSF yes 2.2.2 2.2.1 2002 PSF yes 2.2.3 2.2.2 2003 PSF yes 2.3 2.2.2 2002-2003 PSF yes 2.3.1 2.3 2002-2003 PSF yes 2.3.2 2.3.1 2002-2003 PSF yes 2.3.3 2.3.2 2002-2003 PSF yes 2.3.4 2.3.3 2004 PSF yes 2.3.5 2.3.4 2005 PSF yes 2.4 2.3 2004 PSF yes 2.4.1 2.4 2005 PSF yes 2.4.2 2.4.1 2005 PSF yes 2.4.3 2.4.2 2006 PSF yes 2.5 2.4 2006 PSF yes 2.5.1 2.5 2007 PSF yes 2.5.2 2.5.1 2008 PSF yes 2.5.3 2.5.2 2008 PSF yes 2.6 2.5 2008 PSF yes 2.6.1 2.6 2008 PSF yes 2.6.2 2.6.1 2009 PSF yes 2.6.3 2.6.2 2009 PSF yes 2.6.4 2.6.3 2010 PSF yes 2.7 2.6 2010 PSF yes

Footnotes:

(1) GPL-compatible doesn't mean that we're distributing Python under the GPL. All Python licenses, unlike the GPL, let you distribute a modified version without making your changes open source. The GPL-compatible licenses make it possible to combine Python with other software that is released under the GPL; the others don't.

(2) According to Richard Stallman, 1.6.1 is not GPL-compatible, because its license has a choice of law clause. According to CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1

Page 320: MySQL Workbench

Python License

312

is "not incompatible" with the GPL.

Thanks to the many outside volunteers who have worked under Guido'sdirection to make these releases possible.

B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON

PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2--------------------------------------------

1. This LICENSE AGREEMENT is between the Python Software Foundation("PSF"), and the Individual or Organization ("Licensee") accessing andotherwise using this software ("Python") in source or binary form andits associated documentation.

2. Subject to the terms and conditions of this License Agreement, PSFhereby grants Licensee a nonexclusive, royalty-free, world-widelicense to reproduce, analyze, test, perform and/or display publicly,prepare derivative works, distribute, and otherwise use Pythonalone or in any derivative version, provided, however, that PSF'sLicense Agreement and PSF's notice of copyright, i.e., "Copyright (c)2001, 2002, 2003, 2004, 2005, 2006 Python Software Foundation; All RightsReserved" are retained in Python alone or in any derivative version prepared by Licensee.

3. In the event Licensee prepares a derivative work that is based onor incorporates Python or any part thereof, and wants to makethe derivative work available to others as provided herein, thenLicensee hereby agrees to include in any such work a brief summary ofthe changes made to Python.

4. PSF is making Python available to Licensee on an "AS IS"basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS ORIMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO ANDDISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESSFOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOTINFRINGE ANY THIRD PARTY RIGHTS.

5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHONFOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS ASA RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.

6. This License Agreement will automatically terminate upon a materialbreach of its terms and conditions.

7. Nothing in this License Agreement shall be deemed to create anyrelationship of agency, partnership, or joint venture between PSF andLicensee. This License Agreement does not grant permission to use PSFtrademarks or trade name in a trademark sense to endorse or promoteproducts or services of Licensee, or any third party.

8. By copying, installing or otherwise using Python, Licenseeagrees to be bound by the terms and conditions of this LicenseAgreement.

BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0-------------------------------------------

BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1

1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having anoffice at 160 Saratoga Avenue, Santa Clara, CA 95051, and theIndividual or Organization ("Licensee") accessing and otherwise usingthis software in source or binary form and its associateddocumentation ("the Software").

Page 321: MySQL Workbench

Python License

313

2. Subject to the terms and conditions of this BeOpen Python LicenseAgreement, BeOpen hereby grants Licensee a non-exclusive,royalty-free, world-wide license to reproduce, analyze, test, performand/or display publicly, prepare derivative works, distribute, andotherwise use the Software alone or in any derivative version,provided, however, that the BeOpen Python License is retained in theSoftware, alone or in any derivative version prepared by Licensee.

3. BeOpen is making the Software available to Licensee on an "AS IS"basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS ORIMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO ANDDISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESSFOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOTINFRINGE ANY THIRD PARTY RIGHTS.

4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THESOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSSAS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANYDERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.

5. This License Agreement will automatically terminate upon a materialbreach of its terms and conditions.

6. This License Agreement shall be governed by and interpreted in allrespects by the law of the State of California, excluding conflict oflaw provisions. Nothing in this License Agreement shall be deemed tocreate any relationship of agency, partnership, or joint venturebetween BeOpen and Licensee. This License Agreement does not grantpermission to use BeOpen trademarks or trade names in a trademarksense to endorse or promote products or services of Licensee, or anythird party. As an exception, the "BeOpen Python" logos available athttp://www.pythonlabs.com/logos.html may be used according to thepermissions granted on that web page.

7. By copying, installing or otherwise using the software, Licenseeagrees to be bound by the terms and conditions of this LicenseAgreement.

CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1---------------------------------------

1. This LICENSE AGREEMENT is between the Corporation for NationalResearch Initiatives, having an office at 1895 Preston White Drive,Reston, VA 20191 ("CNRI"), and the Individual or Organization("Licensee") accessing and otherwise using Python 1.6.1 software insource or binary form and its associated documentation.

2. Subject to the terms and conditions of this License Agreement, CNRIhereby grants Licensee a nonexclusive, royalty-free, world-widelicense to reproduce, analyze, test, perform and/or display publicly,prepare derivative works, distribute, and otherwise use Python 1.6.1alone or in any derivative version, provided, however, that CNRI'sLicense Agreement and CNRI's notice of copyright, i.e., "Copyright (c)1995-2001 Corporation for National Research Initiatives; All RightsReserved" are retained in Python 1.6.1 alone or in any derivativeversion prepared by Licensee. Alternately, in lieu of CNRI's LicenseAgreement, Licensee may substitute the following text (omitting thequotes): "Python 1.6.1 is made available subject to the terms andconditions in CNRI's License Agreement. This Agreement together withPython 1.6.1 may be located on the Internet using the followingunique, persistent identifier (known as a handle): 1895.22/1013. ThisAgreement may also be obtained from a proxy server on the Internetusing the following URL: http://hdl.handle.net/1895.22/1013".

3. In the event Licensee prepares a derivative work that is based on

Page 322: MySQL Workbench

Python License

314

or incorporates Python 1.6.1 or any part thereof, and wants to makethe derivative work available to others as provided herein, thenLicensee hereby agrees to include in any such work a brief summary ofthe changes made to Python 1.6.1.

4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS ORIMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO ANDDISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESSFOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOTINFRINGE ANY THIRD PARTY RIGHTS.

5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS ASA RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.

6. This License Agreement will automatically terminate upon a materialbreach of its terms and conditions.

7. This License Agreement shall be governed by the federalintellectual property law of the United States, including withoutlimitation the federal copyright law, and, to the extent suchU.S. federal law does not apply, by the law of the Commonwealth ofVirginia, excluding Virginia's conflict of law provisions.Notwithstanding the foregoing, with regard to derivative works basedon Python 1.6.1 that incorporate non-separable material that waspreviously distributed under the GNU General Public License (GPL), thelaw of the Commonwealth of Virginia shall govern this LicenseAgreement only as to issues arising under or with respect toParagraphs 4, 5, and 7 of this License Agreement. Nothing in thisLicense Agreement shall be deemed to create any relationship ofagency, partnership, or joint venture between CNRI and Licensee. ThisLicense Agreement does not grant permission to use CNRI trademarks ortrade name in a trademark sense to endorse or promote products orservices of Licensee, or any third party.

8. By clicking on the "ACCEPT" button where indicated, or by copying,installing or otherwise using Python 1.6.1, Licensee agrees to bebound by the terms and conditions of this License Agreement.

ACCEPT

CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2--------------------------------------------------

Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,The Netherlands. All rights reserved.

Permission to use, copy, modify, and distribute this software and itsdocumentation for any purpose and without fee is hereby granted,provided that the above copyright notice appear in all copies and thatboth that copyright notice and this permission notice appear insupporting documentation, and that the name of Stichting MathematischCentrum or CWI not be used in advertising or publicity pertaining todistribution of the software without specific, written priorpermission.

STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TOTHIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY ANDFITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLEFOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGESWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ANACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUTOF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Page 323: MySQL Workbench

Python License

315

Licenses and Acknowledgements for Incorporated Software========================================================

This section is an incomplete, but growing list of licenses and acknowledgements for third-party software incorporated in the Python distribution.

Mersenne Twister================The _random module includes code based on a download from http://www.math.keio.ac.jp/ matumoto/MT2002/emt19937ar.html. The following are the verbatim comments from the original code:

A C-program for MT19937, with initialization improved 2002/1/26.Coded by Takuji Nishimura and Makoto Matsumoto.

Before using, initialize the state by using init_genrand(seed)or init_by_array(init_key, key_length).

Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,All rights reserved.

Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditionsare met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOTLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FORA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Any feedback is very welcome.http://www.math.keio.ac.jp/matumoto/emt.htmlemail: [email protected]

Sockets=======The socket module uses the functions, getaddrinfo(), and getnameinfo(), which are coded in separate source files from the WIDE Project, http://www.wide.ad.jp/.

Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.All rights reserved.

Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditionsare met:1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.3. Neither the name of the project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS "AS IS" ANDGAI_ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE FOR GAI_ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON GAI_ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN GAI_ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Floating point exception control================================

Page 324: MySQL Workbench

Python License

316

The source for the fpectl module includes the following notice:

--------------------------------------------------------------------- / Copyright (c) 1996. \| The Regents of the University of California. || All rights reserved. || || Permission to use, copy, modify, and distribute this software for || any purpose without fee is hereby granted, provided that this en- || tire notice is included in all copies of any software which is or || includes a copy or modification of this software and in all || copies of the supporting documentation for such software. || || This work was produced at the University of California, Lawrence || Livermore National Laboratory under contract no. W-7405-ENG-48 || between the U.S. Department of Energy and The Regents of the || University of California for the operation of UC LLNL. || || DISCLAIMER || || This software was prepared as an account of work sponsored by an || agency of the United States Government. Neither the United States || Government nor the University of California nor any of their em- || ployees, makes any warranty, express or implied, or assumes any || liability or responsibility for the accuracy, completeness, or || usefulness of any information, apparatus, product, or process || disclosed, or represents that its use would not infringe || privately-owned rights. Reference herein to any specific commer- || cial products, process, or service by trade name, trademark, || manufacturer, or otherwise, does not necessarily constitute or || imply its endorsement, recommendation, or favoring by the United || States Government or the University of California. The views and || opinions of authors expressed herein do not necessarily state or || reflect those of the United States Government or the University || of California, and shall not be used for advertising or product | \ endorsement purposes. / ---------------------------------------------------------------------

MD5 message digest algorithm============================The source code for the md5 module contains the following notice:

Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved.

This software is provided 'as-is', without any express or impliedwarranty. In no event will the authors be held liable for any damagesarising from the use of this software.

Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute itfreely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.3. This notice may not be removed or altered from any source distribution.

L. Peter [email protected]

Independent implementation of MD5 (RFC 1321).

This code implements the MD5 Algorithm defined in RFC 1321, whose

Page 325: MySQL Workbench

Python License

317

text is available at http://www.ietf.org/rfc/rfc1321.txtThe code is derived from the text of the RFC, including the test suite(section A.5) but excluding the rest of Appendix A. It does not includeany code or documentation that is identified in the RFC as beingcopyrighted.

The original and principal author of md5.h is L. Peter Deutsch<[email protected]>. Other authors are noted in the change historythat follows (in reverse chronological order):

2002-04-13 lpd Removed support for non-ANSI compilers; removed references to Ghostscript; clarified derivation from RFC 1321; now handles byte order either statically or dynamically.1999-11-04 lpd Edited comments slightly for automatic TOC extraction.1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); added conditionalization for C++ compilation from Martin Purschke <[email protected]>.1999-05-03 lpd Original version.

Asynchronous socket services============================The asynchat and asyncore modules contain the following notice:

Copyright 1996 by Sam Rushing

All Rights Reserved

Permission to use, copy, modify, and distribute this software andits documentation for any purpose and without fee is herebygranted, provided that the above copyright notice appear in allcopies and that both that copyright notice and this permissionnotice appear in supporting documentation, and that the name of SamRushing not be used in advertising or publicity pertaining todistribution of the software without specific, written priorpermission.

SAM RUSHING DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, INNO EVENT SHALL SAM RUSHING BE LIABLE FOR ANY SPECIAL, INDIRECT ORCONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSSOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR INCONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Cookie management=================The Cookie module contains the following notice:

Copyright 2000 by Timothy O'Malley <[email protected]>

All Rights Reserved

Permission to use, copy, modify, and distribute this softwareand its documentation for any purpose and without fee is herebygranted, provided that the above copyright notice appear in allcopies and that both that copyright notice and this permissionnotice appear in supporting documentation, and that the name ofTimothy O'Malley not be used in advertising or publicitypertaining to distribution of the software without specific, writtenprior permission.

Timothy O'Malley DISCLAIMS ALL WARRANTIES WITH REGARD TO THISSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITYAND FITNESS, IN NO EVENT SHALL Timothy O'Malley BE LIABLE FORANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGESWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,

Page 326: MySQL Workbench

Python License

318

WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUSACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE ORPERFORMANCE OF THIS SOFTWARE.

Profiling=========The profile and pstats modules contain the following notice:

Copyright 1994, by InfoSeek Corporation, all rights reserved.Written by James Roskind

Permission to use, copy, modify, and distribute this Python softwareand its associated documentation for any purpose (subject to therestriction in the following sentence) without fee is hereby granted,provided that the above copyright notice appears in all copies, andthat both that copyright notice and this permission notice appear insupporting documentation, and that the name of InfoSeek not be used inadvertising or publicity pertaining to distribution of the softwarewithout specific, written prior permission. This permission isexplicitly restricted to the copying and modification of the softwareto remain in Python, compiled Python, or other languages (such as C)wherein the modified or derived code is exclusively imported into aPython module.

INFOSEEK CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THISSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY ANDFITNESS. IN NO EVENT SHALL INFOSEEK CORPORATION BE LIABLE FOR ANYSPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVERRESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OFCONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR INCONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Execution tracing=================The trace module contains the following notice:

portions copyright 2001, Autonomous Zones Industries, Inc., all rights...err... reserved and offered to the public under the terms of thePython 2.2 license.Author: Zooko O'Whielacronxhttp://zooko.com/mailto:[email protected]

Copyright 2000, Mojam Media, Inc., all rights reserved.Author: Skip Montanaro

Copyright 1999, Bioreason, Inc., all rights reserved.Author: Andrew Dalke

Copyright 1995-1997, Automatrix, Inc., all rights reserved.Author: Skip Montanaro

Copyright 1991-1995, Stichting Mathematisch Centrum, all rights reserved.

Permission to use, copy, modify, and distribute this Python software and its associated documentation for any purpose without fee is herebygranted, provided that the above copyright notice appears in all copies, and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of neither Automatrix, Bioreason or Mojam Media be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission.

UUencode and UUdecode functions===============================

The uu module contains the following notice:

Copyright 1994 by Lance EllinghouseCathedral City, California Republic, United States of America. All Rights ReservedPermission to use, copy, modify, and distribute this software and itsdocumentation for any purpose and without fee is hereby granted,

Page 327: MySQL Workbench

Python License

319

provided that the above copyright notice appear in all copies and thatboth that copyright notice and this permission notice appear insupporting documentation, and that the name of Lance Ellinghousenot be used in advertising or publicity pertaining to distributionof the software without specific, written prior permission.LANCE ELLINGHOUSE DISCLAIMS ALL WARRANTIES WITH REGARD TOTHIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY ANDFITNESS, IN NO EVENT SHALL LANCE ELLINGHOUSE CENTRUM BE LIABLEFOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGESWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ANACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUTOF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Modified by Jack Jansen, CWI, July 1995:- Use binascii module to do the actual line-by-line conversion between ascii and binary. This results in a 1000-fold speedup. The C version is still 5 times faster, though.- Arguments more compliant with Python standard

XML Remote Procedure Calls¶

The xmlrpclib module contains the following notice:

The XML-RPC client interface is

Copyright (c) 1999-2002 by Secret Labs ABCopyright (c) 1999-2002 by Fredrik Lundh

By obtaining, using, and/or copying this software and/or itsassociated documentation, you agree that you have read, understood,and will comply with the following terms and conditions:

Permission to use, copy, modify, and distribute this software andits associated documentation for any purpose and without fee ishereby granted, provided that the above copyright notice appears inall copies, and that both that copyright notice and this permissionnotice appear in supporting documentation, and that the name ofSecret Labs AB or the author not be used in advertising or publicitypertaining to distribution of the software without specific, writtenprior permission.

SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARDTO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHORBE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANYDAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUSACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCEOF THIS SOFTWARE.

test_epoll==========The test_epoll contains the following notice:

Copyright (c) 2001-2006 Twisted Matrix Laboratories.

Permission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the"Software"), to deal in the Software without restriction, includingwithout limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and topermit persons to whom the Software is furnished to do so, subject tothe following conditions:

The above copyright notice and this permission notice shall beincluded in all copies or substantial portions of the Software.

Page 328: MySQL Workbench

Scintilla License

320

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE ANDNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BELIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTIONOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTIONWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Select kqueue=============The select and contains the following notice for the kqueue interface:

Copyright (c) 2000 Doug White, 2006 James Knight, 2007 Christian HeimesAll rights reserved.

Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditionsare met:1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' ANDANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

strtod and dtoa===============The file Python/dtoa.c, which supplies C functions dtoa and strtod for conversion of C doubles to and from strings, is derived from the file of the same name by David M. Gay, currently available from http://www.netlib.org/fp/. The original file, as retrieved on March 16, 2009, contains the following copyright and licensing notice:

/**************************************************************** * * The author of this software is David M. Gay. * * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. * * Permission to use, copy, modify, and distribute this software for * any purpose without fee is hereby granted, provided that this entire * notice is included in all copies of any software which is or * includes a copy or modification of this software and in all copies * of the supporting documentation for such software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT * MAKES ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR * PURPOSE. * ***************************************************************/

Scintilla License

The following software may be included in this product:

Scintilla

License for Scintilla and SciTE

Copyright 1998-2003 by Neil Hodgson <[email protected]>

All Rights Reserved

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted,

Page 329: MySQL Workbench

Scintilla License

321

provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation.

NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Scintilla includes some files copyright Adobe Systems Incorporated:

Copyright (c) 2007 Adobe Systems Incorporated

Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to deal inthe Software without restriction, including without limitation the rights touse, copy, modify, merge, publish, distribute, sublicense, and/or sell copiesof the Software, and to permit persons to whom the Software is furnished to doso, subject to the following conditions:

The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORSOR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR INCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

----

Scintilla includes some files copyright Apple Computer, Inc.:

Disclaimer: IMPORTANT: This Apple software is supplied to you by AppleComputer, Inc. ("Apple") in consideration of your agreement to the followingterms, and your use, installation, modification or redistribution of thisApple software constitutes acceptance of these terms. If you do not agreewith these terms, please do not use, install, modify or redistribute thisApple software.

In consideration of your agreement to abide by the following terms, andsubject to these terms, Apple grants you a personal, non-exclusive license,under Apple's copyrights in this original Apple software (the "AppleSoftware"), to use, reproduce, modify and redistribute the Apple Software,with or without modifications, in source and/or binary forms; provided thatif you redistribute the Apple Software in its entirety and withoutmodifications, you must retain this notice and the following text anddisclaimers in all such redistributions of the Apple Software. Neither thename, trademarks, service marks or logos of Apple Computer, Inc. may be usedto endorse or promote products derived from the Apple Software withoutspecific prior written permission from Apple. Except as expressly stated inthis notice, no other rights or licenses, express or implied, are granted byApple herein, including but not limited to any patent rights that may beinfringed by your derivative works or by other works in which the AppleSoftware may be incorporated.

The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NOWARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIEDWARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULARPURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR INCOMBINATION WITH YOUR PRODUCTS.

Page 330: MySQL Workbench

ScintillaNET License

322

IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL ORCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OFSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESSINTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATIONAND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDERTHEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OROTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright (c) 2002 Apple Computer, Inc., All Rights Reserved

ScintillaNET LicenseThe following software may be included in this product:

ScintillaNET

ScintillaNET is based on the Scintilla component by Neil Hodgson.

ScintillaNET is released on this same license.

The ScintillaNET bindings are Copyright 2002-2006 by Garrett Serack <[email protected]>

All Rights Reserved

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation.

GARRETT SERACK AND ALL EMPLOYERS PAST AND PRESENT DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL GARRETT SERACK AND ALL EMPLOYERS PAST AND PRESENT BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

The license for Scintilla is as follows: ----------------------------------------------------------------------- Copyright 1998-2006 by Neil Hodgson <[email protected]>

All Rights Reserved

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation.

NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

TinyXML LicenseThe following software may be included in this product:

TinyXML

Page 331: MySQL Workbench

TreeViewAdv for .NET License

323

TinyXML is released under the zlib license:

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.

2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

TreeViewAdv for .NET LicenseThe following software may be included in this product:

TreeViewAdv for .NET

The BSD License

Copyright (c) 2009, Andrey Gliznetsov ([email protected])

All rights reserved.

Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditionsare met

- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation andor other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORSAS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOTLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESSFOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THECOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVERCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICTLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING INANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF SUCH DAMAGE.

VSQLite++ LicenseThe following software may be included in this product:

VSQLite++

VSQLite++ - virtuosic bytes SQLite3 C++ wrapper

Page 332: MySQL Workbench

zlib License

324

Copyright (c) 2006 Vinzenz Feenstra [email protected] rights reserved.

Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* Neither the name of virtuosic bytes nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

zlib License

The following software may be included in this product:

zlib

Oracle gratefully acknowledges the contributions of Jean-loup Gailly and Mark Adler in creating the zlibgeneral purpose compression library which is used in this product.

zlib.h -- interface of the 'zlib' general purpose compression libraryCopyright (C) 1995-2004 Jean-loup Gailly and Mark Adler

zlib.h -- interface of the 'zlib' general purpose compression libraryversion 1.2.3, July 18th, 2005Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler

zlib.h -- interface of the 'zlib' general purpose compression libraryversion 1.2.5, April 19th, 2010Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied warranty.In no event will the authors be held liable for any damages arising from theuse of this software. Permission is granted to anyone to use this softwarefor any purpose,including commercial applications, and to alter it andredistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.3. This notice may not be removed or altered from any source distribution.

Jean-loup Gailly [email protected]

Page 333: MySQL Workbench

zlib License

325

Mark Adler [email protected]

Page 334: MySQL Workbench

326

Page 335: MySQL Workbench

327

Appendix B. MySQL Workbench FAQFrequently Asked Questions with answers.

Questions

• B.1: [327] How does MySQL Workbench increase import performance?

• B.2: [327] MySQL Workbench 5.0 appears to run slowly. How can I increase performance?

• B.3: [328] I get errors when creating or placing objects on an EER Diagram. I am using OpenGLrendering, AMD processor, and ATI graphics hardware.

Questions and Answers

B.1: How does MySQL Workbench increase import performance?

When a model is exported using the main menu item File, Export, Forward Engineer SQL CREATE Script,some server variables are temporarily set to enable faster SQL import by the server. The statementsadded at the start of the code are:

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';

These statements function as follows:

• SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;: Determines whetherInnoDB performs duplicate key checks. Import is much faster for large data sets if this check is notperformed.

• SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;:Determines whether the server should check that a referenced table exists when defining a foreign key.Due to potential circular references, this check must be turned off for the duration of the import, to permitdefining foreign keys.

• SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';: Sets SQL_MODE toTRADITIONAL, causing the server to operate in a more restrictive mode.

These server variables are then reset at the end of the script using the following statements:

SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

B.2: MySQL Workbench 5.0 appears to run slowly. How can I increase performance?

Although graphics rendering may appear slow, there are several other reasons why performance may beless than expected. The following tips may offer improved performance:

• Upgrade to the latest version. MySQL Workbench 5.0 is still being continually maintained and someperformance-related issues may have been resolved.

• Limit the number of steps to save in the Undo History facility. Depending on the operations performed,having an infinite undo history can use a lot of memory after a few hours of work. In Tools, Options,General, enter a number in the range 10 to 20 into the Undo History Size spinbox.

• Disable relationship line crossing rendering. In large diagrams, there may be a significant overheadwhen drawing these line crossings. In Tools, Options, Diagram, uncheck the option named Draw LineCrossings.

Page 336: MySQL Workbench

328

• Check your graphics card driver. The GDI rendering used in MySQL Workbench 5.0 is not inherentlyslow, as most video drivers support hardware acceleration for GDI functions. It can help if you have thelatest native video drivers for your graphics card.

• Upgrade to MySQL Workbench 5.1. MySQL Workbench 5.1 has had many operations optimized. Forexample, opening an object editor, such as the table editor, is much faster, even with a large modelloaded. However, these core optimizations will not be back-ported to 5.0.

B.3: I get errors when creating or placing objects on an EER Diagram. I am using OpenGLrendering, AMD processor, and ATI graphics hardware.

To solve this problem renew the ATI drivers pack, which can be downloaded from the AMD Web site.

Page 337: MySQL Workbench

329

Appendix C. MySQL Workbench and Utilities Change History

Table of ContentsMySQL Workbench Change History ................................................................................................ 329

Changes in Release 5.2 ......................................................................................................... 329Changes in Release 5.1 ......................................................................................................... 424Changes in Release 5.0 ......................................................................................................... 443

MySQL Utilities Change History ...................................................................................................... 460Changes in Release 1.0 ......................................................................................................... 460

This appendix lists the changes from version to version in the MySQL Workbench and MySQL Utilitiessource code.

Note that we tend to update the manual at the same time we make changes to MySQL. If you find a recentversion of the MySQL Workbench or Utilities listed here that you can't find on our download page (http://dev.mysql.com/downloads/), it means that the version has not yet been released.

The date mentioned with a release version is the date of the last Bazaar ChangeSet on which the releasewas based, not the date when the packages were made available. The binaries are usually made availablea few days after the date of the tagged ChangeSet, because building and testing all packages takes sometime.

The manual included in the source and binary distributions may not be fully accurate when it comes to therelease changelog entries, because the integration of the manual happens at build time. For the most up-to-date release changelog, please refer to the online version instead.

MySQL Workbench Change History

The following sections outline the changes between versions for MySQL Workbench.

Changes in Release 5.2

Changes in MySQL Workbench 5.2.40 (Not yet released)

This section documents all changes and bug fixes applied to MySQL Workbench since the release of5.2.39.

Functionality Added or Changed

• The SQL editor tab now displays the selected database in the header. (Bug #50932, Bug #11758694)

• The File, Export, Forward Engineer SQL ... wizards now have the option to use the same configurationsettings from the last time Forward Engineer SQL ... was used. (Bug #34977, Bug #11748058)

Bugs Fixed

• Within the SQL Editor, MySQL Workbench would freeze after choosing Replace All when the find fieldwas empty. (Bug #13744385)

• MySQL Workbench would generate invalid SQL while using the Partitioning tab when altering a table.(Bug #64396, Bug #13788180)

Page 338: MySQL Workbench

Changes in Release 5.2

330

• The Data Export option would not use the current date in the folder name containing the exported data.(Bug #63893, Bug #13571760)

• Database, Synchronize Model would not update the view after a new field was added. (Bug #62569, Bug#13051152)

• On Microsoft Windows, the MySQL Workbench installer would sometimes not detect where VISUAL C++ 2010 was installed.

A workaround is to append CPP_100_RUNTIMES to the eCustomProperties property in the .msi file.(Bug #62141, Bug #12872805)

• After a connection has timed out, clicking Reconnect to DBMS would freeze MySQL Workbench. (Bug#64467, Bug #13840041)

• On Mac OS X, expanding the schema for a remote database from within the SQL Editor tab wouldcrash, if the SQL editor tab was closed before the tables were done being fetched. (Bug #63589, Bug#13500242)

• On Mac OS X, when viewing the results of a query that would normally exceed the window width, thelast column would have a width of one character if the column type was numeric. (Bug #62588, Bug#13365052)

• Within the Database, Synchronize With Any Source wizard, synchronizing a model from a LiveDatabase Server source to a Model Schemata destination would crash after the RetrieveObject Information step. (Bug #64553, Bug #13812932)

• The minimum size of the MySQL Workbench window has been lowered to 980x600 pixels, althoughofficially the minimum screen resolution requirement remains at 1280×1024. (Bug #63519, Bug#13463411)

• MySQL Workbench would not build with GLib 2.3x+, as only glib.h can be included directly. (Bug#63705, Bug #13500364)

• Copying SQL to the clipboard could cause MySQL Workbench to hang or crash if the table commentscontained Unicode characters that exceeded the buffer size. (Bug #64611, Bug #13840045)

• While using MySQL Workbench to adjust a Users and Privileges role with a MySQL Server versionprior to 5.1.6, an unhandled exception would result from MySQL Workbench attempting to access themysql.event table. (Bug #63149, Bug #13496657)

• A query like SELECT foo+1 FROM bar could cause a crash. (Bug #64051, Bug #13629089)

• Scrolling the mouse wheel now only scrolls the focused window. (Bug #61480, Bug #12661387)

• On Fedora Linux version 16 and greater, the service command is now used to start and stop theMySQL Server, instead of /etc/init.d/mysqld. (Bug #63777, Bug #13519817)

• MySQL Workbench would prompt a user for the password to reconnect to a MySQL server that had lostthe connection, and this password dialogue would not have focus yet still showed as the top window witha blinking cursor. To reduce confusion, this password window is no longer the top window. (Bug #62003,Bug #12918370)

• On Windows XP, attempts to copy values from multiple cells would fail, and not insert values into theclipboard. (Bug #64281, Bug #13726466)

• The Open value in viewer window did not open with SELECT queries that used the cast function. (Bug#63874, Bug #13548148)

Page 339: MySQL Workbench

Changes in Release 5.2

331

• The following sequence would crash MySQL Workbench: Database, Reverse Engineer to generate anEER diagram, then Database, Synchronize with Any Source, and then a mouse-click would cause thecrash. (Bug #61876, Bug #12912593)

• The following sequence could crash MySQL Workbench: "Open a model", "Synchronize the model witha remote database", "Modify the model", and then "Synchronize the model" a second time. (Bug #63943,Bug #13779239)

• The Control + a key combination would not select all of the text within a window. (Bug #63752, Bug#13511244)

• SELECT queries could crash MySQL Workbench during the validation stage of the SQL Editor. (Bug#64435, Bug #13788133)

• Queries that explicitly set RESTRICT will now synchronize properly with those that do not, becauseRESTRICT is the default behavior in MySQL. (Bug #62432, Bug #13491535)

• Password-based SSH authentication would still check the key-based authentication files within .ssh/before prompting for a password. (Bug #60024, Bug #12672238)

• The _idx suffix is now added to foreign keys as they are created.

And MySQL Workbench checks for duplicate named foreign keys if a document is loaded from aprevious version of MySQL Workbench. And if duplicates are found, then the user is given the choice ofrenaming them. (Bug #60705, Bug #12621452)

Changes in MySQL Workbench 5.2.39 (10 April 2012)

This release updates the bundled MySQL Utilities to version 1.0.5. It contains no other new features or bugfixes.

Functionality Added or Changed

• Updated the bundled MySQL Utilities to version 1.0.5.

Changes in MySQL Workbench 5.2.38 (23 February 2012)

This section documents all changes and bug fixes applied to MySQL Workbench since the release of5.2.37.

Functionality Added or Changed

• The width of the "Reference column" drop-down selector is now set to the widest entry. (Bug #53278,Bug #11760835)

Bugs Fixed

• On Linux, the result set window would not display properly. (Bug #13615255)

• Comments that spanned multiple lines and included stored procedures with comments that weresurrounded by conditional comments would not be handled properly, as MySQL Workbench would endthe outer comment unconditionally when the first inner comment was finished. (Bug #13490118)

• While editing Limit Connectivity to Host Matching within the Server Administration, Usersand Privileges, Login window, the Apply button would not be available until one of the other three Usersand Privileges fields was changed. (Bug #13470424)

Page 340: MySQL Workbench

Changes in Release 5.2

332

• On Microsoft Windows, using the Manage Server Instances menu to delete server instances could causeMySQL Workbench to generate an internal error while closing the Manage Server Instances window.(Bug #13466083)

• On Linux, MySQL Workbench .mwb files would be detected as Zip files. (Bug #13466584)

• On Microsoft Windows with the "classic mode" theme set, MySQL Workbench buttons were difficult toread. (Bug #13470583)

• Generating a DBDoc report with both HTML Detailed Frames and Include DDL code for objectsenabled would cause MySQL Workbench to stall. (Bug #13471637)

• The SQL Editor Execute the Explain Command... feature did not function properly, and would returnzero results. (Bug #13466571)

• The Plugins, Utilities, Execute Query Into Text Output feature would duplicate the first column, and fill itwith NULL values. (Bug #13470770)

• Scripting Shell would fail to continue running after a breakpoint. Clicking Execute Script after abreakpoint now continues execution of the script. (Bug #13470397)

• The Scripting shell window lost focus after opening and closing a tab. (Bug #13470451)

• For Microsoft Windows, the Download Prerequisites link within the MySQL Workbench installernow directly links to the prerequisites manual page. (Bug #13448582)

• Using the Open Connection to Start Querying dialog with a new (not stored) connection would causeMySQL Workbench to crash. (Bug #13028855)

• On Linux, while saving a new model with a note, the Save to File dialogue would not prompt to name thefile. (Bug #12933345)

• It was possible for MySQL Workbench to generate a pop-up window underneath a different pop-upwindow, thus requiring a restart of MySQL Workbench when the bottom pop-up was required to beclosed first. (Bug #12927510)

• Dumping a schema via the Data export and restore option now prompts for a correct password, asneeded. Before it would simply fail to export. (Bug #12903967)

• The editor tabs would not update after a user was added. (Bug #12884776)

• Under the File menu, using the Print to PDF... and Print to PS File... options for a model would crashMySQL Workbench. (Bug #12884845)

• Opening a Server Administration tab for a server instance that has remote management via SSHenabled would result in an error, and fail to load. (Bug #63857, Bug #13655999)

• Within Server Administration, Users and Privileges, selecting Add Account after sorting the users wouldinsert the new user into the list alphabetically, yet open the bottom user entry into the editor. (Bug#63951, Bug #13702340)

• On Linux, the Object Info panel within the SQL editor would not show information about the object,and would instead remain empty. (Bug #63960, Bug #13608228)

• On Linux and Mac OS X, the Replace All search feature would hang, and not function properly. (Bug#63764, Bug #13520443)

• Query, Commit Result Edits and Query, Discard Result Edits could result in "Unrecognized command"errors, and not function properly. (Bug #63744, Bug #13511195)

Page 341: MySQL Workbench

Changes in Release 5.2

333

• On Microsoft Windows, tab titles were difficult to read on systems with dark backgrounds. (Bug #63715,Bug #13500349)

• The search box within the MySQL Workbench toolbar did not perform searches. (Bug #61825, Bug#12757354)

• On Microsoft Windows, the Open in viewer menu could be blank while viewing results. (Bug #63873,Bug #13548115)

• Closing a tab could result in an unhandled exception. (Bug #64152, Bug #13655860)

• Choosing the Open value in Editor option would scroll the result set to the top. Selecting this option nolonger refreshes the results, so the selected row remains intact. (Bug #63860, Bug #13539049)

• Executing a query after reordering multiple editor tabs would make the inactive editor tab active, andexecute that query. (Bug #63866, Bug #13542154)

• On Microsoft Windows, changing or deleting a row or column within a model, could cause a crash. (Bug#63056, Bug #13344572)

• The object editor could leak memory and crash MySQL Workbench while handling notifications. (Bug#63025, Bug #13492608)

• MySQL Workbench would highlight the MySQL 5.6 reserved words name, type, and types. (Bug#62775, Bug #13252599)

• Clicking the foreign keys tab within the Alter table context could crash MySQL Workbench. (Bug #63050,Bug #13492730)

• Recovery of the last state using either the Auto-save feature, or the Save snapshot of openeditors on close option, would sometimes load improperly by creating an empty schema and/orcrash while closing opened SQL editor tabs. (Bug #61950, Bug #12917371)

• Exporting a model to a CSV file could crash MySQL Workbench. (Bug #63883, Bug #13685708)

• Double-clicking on a table within the EER diagram editor would sometimes crash MySQL Workbench.(Bug #62451, Bug #13014823)

• Selecting and editing multiple indexes or foreign keys would crash MySQL Workbench. (Bug #61863,Bug #62057, Bug #12757370, Bug #13013715)

• On Mac OS X 10.7+, the "Open File" panel would attempt to show hidden files, which would fail andcause no files to be shown. MySQL Workbench no longer attempts to display hidden files on Mac OS X.(Bug #62172, Bug #12912085)

• Pressing the Control + Enter key combination within the SQL editor would generate a recoverable error.(Bug #62169, Bug #12927292)

• The main schema information found within the object browser now updates after a table is altered, andcollapses the expanded details. And selecting an object now reloads the data, which means the current(altered) data is displayed. (Bug #63828, Bug #13538990)

• MySQL Workbench would not work with paramiko 1.7+. (Bug #63750, Bug #13519860)

• MySQL Workbench did not test for and use the gl.pc pkgconfig files if present, to determine the locationof GL/{gl,glx}.h and libGL.so. (Bug #63818, Bug #13538964)

• MySQL Workbench would fail to compile under certain PCRE setups, like when pcre.h existed within /usr/include/pcre/. (Bug #63819, Bug #13538971)

Page 342: MySQL Workbench

Changes in Release 5.2

334

• Moving the placeholder row (an empty row) around within the table editor would crash MySQLWorkbench. The placeholder row can no longer be moved. (Bug #64122, Bug #13629953)

• Choosing the Close All But This option within the routines manager would freeze MySQL Workbench.(Bug #64133, Bug #13630602)

• When viewing the foreign key definition window of the Alter Table editor, the restrict foreign key optiondid not display for either the update or delete actions, and instead the value would appear empty. (Bug#63978, Bug #13596254)

• On Mac OS X, opening files saved from previous versions of MySQL Workbench would result in anempty window, without data being loaded. (Bug #63932, Bug #13571842)

• The Server Status window would incorrectly sort options. Numeric fields are now sorted numerically(e.g., 1300 is now after 500). (Bug #61659, Bug #12698865)

• The File, Open SQL Script, Files of Type dialogue would incorrectly give the option to open files with the.dbquery suffix, instead of .qbquery. (Bug #63861, Bug #13541769)

• A query similar to the following would crash MySQL Workbench: select c.* from actor c whereactor_id=38 (Bug #63940, Bug #13582514)

• The Beautify Query feature incorrectly formatted statements containing the UNION clause, which left thequery with syntax errors. (Bug #64120, Bug #13629967)

• After clicking Apply to alter a table where changes are not being made, the output window says"Preparing..." and does not automatically change to "No changes detected" until the window is clicked.(Bug #63842, Bug #13548232)

• MySQL Workbench would freeze when a SELECT statement was executed on a table without privatekeys, and that included at least one UNIQUE NOT NULL column. (Bug #63867, Bug #13542546)

• On Linux, right-clicking on a table and choosing the Alter Table feature would perform no function.

A workaround was to delete all XML nodes from /usr/share/mysql-workbench/modules/data/editor_mysql_table_live.glade like:

<child internal-child="selection"> <object class="GtkTreeSelection" id="treeview-selection5"/> </child>

(Bug #62686, Bug #13491865)

• Queries containing a UNION are now excluded from the automatic addition of the LIMIT clause, whenthe Limit Rows preference is enabled. (Bug #62524, Bug #13029474)

• After a connection has timed out, clicking Reconnect to DBMS would freeze MySQL Workbench. (Bug#61722, Bug #12725314)

• MySQL Workbench would crash while opening an existing EER model, after a file failed to open. (Bug#63841, Bug #13539006)

• Individual model settings are now respected. Before they would be ignored in favor of the global settings.(Bug #61771, Bug #12757255)

• While attempting to synchronize a database to any source, the Execute button to perform thesynchronization was missing. Only the Go Back and Close buttons were shown. The Execute button isnow standardized for all database synchronization options. (Bug #62130, Bug #12872823)

Page 343: MySQL Workbench

Changes in Release 5.2

335

• On Microsoft Windows, and when called from the home screen, opening and immediately closingthe Manage Server Instances window would result in an unhandled exception. (Bug #63927, Bug#13571816)

• On Mac OS X, exporting a database that has a stored procedure resulted in an unhandled exception.(Bug #63653, Bug #13476062)

• A pop-up window is no longer generated when selecting an inactive server from within the ServerAdministration panel. (Bug #61810, Bug #12757347)

• Running a SELECT statement and attempting to alias the only column selected would result in a crash.(Bug #64123, Bug #13629962)

• When right-clicking on a table that has triggers, and then choosing Create Statement to either sendthe statement to the clipboard or SQL editor, the trigger creation statement is written before the tablecreation statement. (Bug #61698, Bug #12756722)

• MySQL Workbench would crash after the following sequence: Synchronize Model With Database, FetchObject Info, Continue. (Bug #63746, Bug #13591854)

• Tables without an engine set were treated as though they were unable to support foreign keys.Therefore, the foreign key declaration would be missing after forward engineering these tables.

A workaround is to explicitly set the table engine to InnoDB. (Bug #63934, Bug #13562926)

• If the charset/collation is set to use the default value, then DEFAULT will now be inserted as the charset/collation name within generated queries. (Bug #61202, Bug #12622649)

• Plugins, Utilities, Reformat SQL Query would mangle queries by removing the first SELECT statement ifa subquery clause was present. (Bug #60311, Bug #12613662)

• Pasting a query with \r line endings instead of \r\n or \n could cause MySQL Workbench to manglethe query. Line endings are now normalized after pasting, like they already were while loading files. (Bug#56334, Bug #11763603)

• On Microsoft Windows, rapidly repeating a query could emit an error. (Bug #56776, Bug #11763997)

• On Microsoft Windows, the Routines editor would insert extra line endings. (Bug #55006, Bug#11762414)

• The Beautify Query wizard would remove spaces from MySQL date function parameter values thatcontain INTERVAL. (Bug #61021, Bug #12546864)

• On Microsoft Windows, using Alt based key shortcut combinations would not always work. (Bug #54119,Bug #11761607)

• MySQL Workbench would emit an error (error code: 1064) with queries using WITH ROLLUP. (Bug#57178, Bug #11764355)

• MySQL Workbench would not behave correctly with ON UPDATE CURRENT_TIMESTAMP as a defaultvalue, while synchronizing models, and would update the field. (Bug #61087, Bug #12546735)

• When a table had columns like DOUBLE(M,D), the data model synchronization would discard the (M,D)specification, and convert the columns to DOUBLE(11). (Bug #61165, Bug #12565933)

• The dialog windows now remain in front, even when another part of MySQL Workbench is clicked. (Bug#48692, Bug #11756737)

• MySQL Workbench now detects duplicated trigger names while using the Model,Validation, (MySQL)->Validate all and Model, Validation (MySQL), Check integrity sequences. (Bug #44063, Bug #11752780)

Page 344: MySQL Workbench

Changes in Release 5.2

336

Changes in MySQL Workbench 5.2.37 (26 December 2011)

This section documents all changes and bug fixes applied to MySQL Workbench since the release of5.2.36.

Functionality Added or Changed

• The SQL editor now automatically fetches table data. (Bug #63590, Bug #13500202)

Bugs Fixed

• The SQL editor would open a table in read-only mode when opened from either the Edit Table Data linkvia the home screen, or if the schema tree was not expanded. (Bug #13466131)

• On Mac OS X, the File, Open Recent feature would open the incorrect script. (Bug #13028666)

• Viewing the Server Logs on a MySQL server after it has been stopped, resulted in an unhandledexception. (Bug #12908134)

• On Mac OS X, clicking Apply within the Alter Table dialogue on a table with foreign constraints wouldcrash MySQL Workbench. (Bug #62042, Bug #12844307)

• Invalid SQL was generated when a schema name contained a dot. Table names are now enclosed inquotes. (Bug #63710, Bug #13500360)

• MySQL Workbench required the Andale Mono font. (Bug #61782, Bug #12757325)

• The Help, Check for Updates feature did not function properly. (Bug #63534, Bug #13463399)

• The SQL editor would not load under certain circumstances. The check for restoring split positions wascorrected to solve this issue. (Bug #63582, Bug #13490891)

• The password prompt dialog is no longer the topmost window over all open applications on a system, butnow it's only the topmost MySQL Workbench window. (Bug #63499, Bug #13496347)

• MySQL Workbench now quotes table names in generated SQL queries, when the table name containscharacters that would break the SQL statement. (Bug #63600, Bug #13497088)

• Generating a list of tables and views was slow, when compared to the previous MySQL Workbenchversion. (Bug #63633, Bug #13485667)

• The field editor would hang when large text values were shown. (Bug #63606, Bug #13485779)

• MySQL Workbench would sometimes be unable to save changes that were only to comments. It used ahard limit, but now uses the MySQL Server limit for maximum comment lengths. For example, it wouldcompare the first 60 characters of a table comment change, and generate an error if the change did notaffect the first 60 characters.

From the MySQL Server 5.5.3 changelog: the maximum length of table comments was extended from60 to 2048 characters. The maximum length of column comments was extended from 255 to 1024characters. Index definitions now can include a comment of up to 1024 characters. (Bug #61626, Bug#12694146)

• MySQL Workbench would generate an exception after editing and then closing a table tab within theEER diagram window. (Bug #63591, Bug #13463991)

• Creating a foreign key using the Place a relationship using existing columns EER option would crashMySQL Workbench. (Bug #63629, Bug #13480328)

Page 345: MySQL Workbench

Changes in Release 5.2

337

• Exporting a database that has a stored procedure, resulted in an unhandled exception. (Bug #63653,Bug #13476062)

• The user administration panel did not fit on systems using a 1024x768 screen resolution. (Bug #62341,Bug #12967541)

• Changing a schema name with routines present would prepend and append invalid delimiters. (Bug#63624, Bug #13470435)

• MySQL Workbench could freeze while importing a dump. (Bug #63669, Bug #13485795)

• The export feature would sometimes fail when exporting tables with stored procedures, and with DumpStored Procedures checked. And also having Export as Dump Project Folder selectedwould result in an unhandled exception. (Bug #57500, Bug #11764642)

• Case changes to ENUM values were not recognized by MySQL Workbench. (Bug #60478, Bug#11889204)

• Database synchronization would sometimes confuse similar table and routine names. (Bug #61028, Bug#12656879)

• Altering the case of a table name caused an error, when that was the only change and the SQLIdentifiers are Case Sensitive option was set to true. (Bug #58808, Bug #11765806)

• The Forward engineering feature now preserves case for schema names, even on case-insensitivesystems. Before it would create lowercase variants of the schema names on these systems. (Bug#56237, Bug #11763520)

• Within the Database, Forward Engineer dialogue for a Model, the DROP Objects Before EachCREATE Object option was ignored if the Export MySQL Table Objects option was not selected.(Bug #59200, Bug #11766157)

• The Forward engineer feature would sometimes create invalid SQL syntax for old MySQL Workbenchfiles with deleted routines and roles. (Bug #53973, Bug #11761473)

Changes in MySQL Workbench 5.2.36 (3 December 2011)

This section documents all changes and bug fixes applied to MySQL Workbench since the release of5.2.35.

Known limitation: Home, Edit Table Data will load the table in read-only mode. Instead, right-click on atable within the Object Browser and choose the Edit Table Data option from there.

Functionality Added or Changed

• The Edit, Format, Beautify Query feature no longer quotes column names. (Bug #13030351)

• If only one server instance is defined, then the Server administration, Manage security option willnow automatically connect to it, instead of prompting to choose a server instance. (Bug #61451, Bug#12647697)

• The edit context menus, such as Edit Table Data, now open as new tabs. Before they reused(overwrote) the same tab. (Bug #61774, Bug #12731459)

• MySQL Workbench did not support the .dbquery file extension. (Bug #54321, Bug #11761795)

• The export result set dialog has been redesigned, and now saves the previously used settings. (Bug#60490, Bug #11889185)

Page 346: MySQL Workbench

Changes in Release 5.2

338

• Indexes are now shown within the schema tree. And indexed columns are also indicated within the tableinformation panel. (Bug #61295, Bug #12616367)

• The auto_increment information is now displayed within the SQL editor. (Bug #60933, Bug#12402845)

• The query and associated results are no longer displayed in separate tabs, but they are now viewablewithin a single interface. (Bug #60624, Bug #11926853)

• Added the ability to edit data from a result set after executing a query. If MySQL Workbench determinesthat a returned result cannot be edited, then a read-only icon will be displayed, and hovering over theicon reveals a tooltip that explains why it cannot be edited. (Bug #56794, Bug #11764013)

• Added the Copy Inserts to Clipboard option to the Plugins, Objects menu. (Bug #54036, Bug#11761531)

• The Overview tab was removed, in favor of the new schema layout. (Bug #53323, Bug #11760879)

• On the SQL Editor tabs, right-clicking a tab now offers the following options: New Tab, Save Tab, CloseTab, Close Other Tabs, and Copy Path to Clipboard. (Bug #60883, Bug #12399369)

• Additional Export data types were added to the SQL Browser, which now includes JSON, Excelspreadsheet, and MySQL formatted XML. (Bug #56808, Bug #11764024)

• The SQL editor windows did not have maximize or minimize buttons, but these windows are now openedin configurable tabs. (Bug #60606, Bug #12617245)

• SQL snippets can now be edited, and then saved. (Bug #58879, Bug #11765873)

• A Paste Row context option was added to the Edit Table Data menu of the Object browser. (Bug#58169, Bug #11765228)

• The Overview tab was replaced, in favor of the new schema tree view. (Bug #56795, Bug #11764014)

• Tab spacing is now defined as 4 on the Linux and Mac platforms, to be consistent with Windows. (Bug#58867, Bug #11765862)

• The Alter table option defaulted to Table view, but now uses the new table editor. (Bug #55050, Bug#11762454)

• Added a input field to filter the schema list in the Object Browser. (Bug #55162, Bug #11762554)

• Added toolbar buttons to toggle the sidebars and bottom panel of the SQL Editor. (Bug #53714, Bug#11761243)

• The table view within the Object Browser has changed. The table view includes another level ofgrouping, which includes Columns, Indexes, Foreign Keys, and Triggers. Before, only the columns werelisted. (Bug #53504, Bug #11761050)

• The table information window within the Object Browser has been expanded to include foreign keys,triggers, indexes, and data types. (Bug #53502, Bug #11761048)

• New entries to the error log are now shown when restarting the MySQL server.

When log_output is set to FILE, the log files are now displayed in the MySQL Workbench log page.(Bug #52445, Bug #11760073)

• The SQL Editor history tab now auto-scrolls to the bottom, so that the most recent entry is visible. (Bug#49317, Bug #11757294)

Page 347: MySQL Workbench

Changes in Release 5.2

339

• Added a new format to the SQL Editor for export, which is identical to the XML generated by the mysql--xml command. It's titled XML (mysql format). (Bug #49305, Bug #11757284)

• The SQL snippets interface been redesigned and relocated to its own sidebar. Its display may also betoggled. (Bug #50069, Bug #11757950)

• Added the ability to copy Status and System Variables to the clipboard. (Bug #49074, Bug #11757074)

• The Database, Synchronize Model... dialogue now creates a schema if one does not already exist. (Bug#45025, Bug #11753561)

Bugs Fixed

• While using the import/restore feature of the server instance administration area, views and routineswere not imported. (Bug #13041684)

• After right-clicking a cell within the insert grid of the model table editor, an unhandled exception wasgenerated on Microsoft Windows, and a fatal error on Mac OS X. (Bug #13029647)

• While administrating a server instance, importing a project folder will result in an "Import from Disk" errorafter the following sequence: Data Export and restore, Export to Dump project folder, with Dump viewsand Dump stored routines... checked, then exporting a schema with views and/or routines,opening the SQL Editor and dropping the exported schema, then clicking Import to Disk within the serveradministrator. (Bug #13025419)

• The Manage Security window initially shows the first connection as selected, but it is not. (Bug#13026478)

• Pressing Refresh within the Slow Query Log tab resulted in an unhandled exception. (Bug #12928308)

• A previously selected object could not be dragged, as it would instead enter "Edit Name" mode after thesecond click. (Bug #12884796)

• Within a diagram view, the Edit, Find, Find advanced option was unrecognized and performed nofunction. (Bug #12884864)

• New server instances created by the Manage Server Instance wizard would send the incorrect servicename to the MySQL admin. The command is now constructed at run time using the service name fromthe server instance profile. (Bug #12567371)

• The Alter Table... option did not function on tables with triggers. (Bug #12546727, Bug #61110)

• Right-clicking on a row within the Inserts tab could crash MySQL Workbench. (Bug #62583, Bug#13365077)

• Altering and saving a routine twice, reverting, and then clicking Apply would crash MySQL Workbench(Bug #62979, Bug #13492510)

• The Alter Routine wizard would report that a routine was successfully updated, although the routinewould remain unchanged. (Bug #62527, Bug #13029468)

• On Microsoft Windows, and with the Show Live Schema Overview preference disabled, MySQLWorkbench would emit an error while attempting to open a Database Connection. (Bug #62407, Bug#13364933)

• Selecting and dragging tables to the diagram area would fail. A workaround was to collapse the tablelist first and then drag it over, although it was only possible to drag a single table. (Bug #62267, Bug#13013851)

Page 348: MySQL Workbench

Changes in Release 5.2

340

• On Microsoft Windows 7, some MySQL Workbench buttons would be difficult to read due to incompatiblebackground colors with the "Windows classic Style" scheme. (Bug #61685, Bug #12711145)

• The Server Administrator did not function with MySQL Server 5.0. And although MySQLWorkbench does not officially support MySQL Server 5.0, this functionality now works. (Bug #62549,Bug #13029339)

• The Reconnect to DBMS toolbar option would not reconnect after unchecking the Safe Updatespreference. A workaround is to uncheck this option, then restart MySQL Workbench. (Bug #62448, Bug#13014798)

• Switching between two logins for a single database connection required the password to be reenteredwith each switch. (Bug #62052, Bug #12921420)

• The Create Routine... feature would report that it created a routine, but it did not, and the error wasrevealed in the output window. (Bug #62624, Bug #13362190)

• A query history date would incorrectly change when a history entry, other than the last one, was selectedwhen the query was executed. (Bug #62642, Bug #13104635)

• On Microsoft Windows, the EER diagram search did not work across multiple pages. (Bug #61957, Bug#12818216)

• On Linux, the Database, Generate Catalog Diff Report... model option was disabled. (Bug #62040, Bug#12844314)

• The Configuration File path within the Server Administration panel is now read-only, when beforeit would temporarily set the path. This path should be set via the profile setting instead. (Bug #62252,Bug #12922746)

• The Users and Privileges window did not scale to low screen resolutions like 1024x768. It does now,although MySQL Workbench still has an official minimum screen resolution of 1280x800. (Bug #61518,Bug #12661556)

• On Ubuntu 11.10, MySQL Workbench would freeze at the startup splash screen. (Bug #62347, Bug#13099521)

• On Microsoft Windows, upgrading MySQL Workbench required MySQL Workbench to be run as a userwith Administrator rights. (Bug #62709, Bug #13116366)

• An unhandled exception might be emitted after modifying an EER diagram, with a popup window reading"MySQL Workbench has encountered a problem - Queue empty." (Bug #62651, Bug #13079826)

• MySQL Workbench would not recognize the active schema with case insensitive servers. As a result, anactive schema within the Object browser would be unselected after a USE statement was executed. (Bug#61641, Bug #12711143)

• The File, Open Recent feature would open the incorrect script. (Bug #61856, Bug #12912374)

• Repeatedly refreshing a schema resulted in an unhandled exception. (Bug #61892, Bug #12762893)

• Expanding then collapsing the query results window within the SQL editor, yielded a differentappearance. (Bug #62371, Bug #13007096)

• Fixed Data export so that routines and views are only exported when they are selected. In addition,individual views may now be selected for export. (Bug #61937, Bug #12949918)

• After setting a default schema, choosing Refresh all while the schema information is "fetching" wouldresult in an unhandled exception. (Bug #62086, Bug #12913399)

Page 349: MySQL Workbench

Changes in Release 5.2

341

• Using Alter routine to make changes would sometimes crash after clicking Apply. (Bug #63076, Bug#13340307)

• Tab panels within Server Administration would not fresh properly. (Bug #61452, Bug #12647731)

• Opening model files while using a MySQL Workbench version that was installed over a previous MySQLWorkbench installation would sometimes cause permission issues. The workarounds included runningMySQL Workbench with administrator privileges, or removing the installation folder before upgrading.(Bug #62703, Bug #13323929)

• File, Export, Forward Engineer SQL CREATE Script would append an extra space to TINYINT(1) afterconverting it from BOOL. (Bug #61696, Bug #12711138)

• A Download Prerequisites link is now displayed when prerequisites, such as the "Visual C++ 2010Redistributable Package" requirement, are not met. Before, the link was not visible. (Bug #61897, Bug#12769499)

• Opening Management, Server Logs would generate an unhandled exception when using table-basedlogging, while the general log was empty. (Bug #62123, Bug #12872836)

• Creating a server instance using unicode characters worked, but an error would be generated whileattempting to open them. (Bug #63100, Bug #13350556)

• Fixed a typo, where "database" was misspelled as "dabase" within the DBDesigner description. (Bug#62250, Bug #12912465)

• The Auto-save feature would behave with unpredictable results, by opening up an incorrect number ofwindows when MySQL Workbench was next loaded. (Bug #62192, Bug #12907612)

• Within the Routine Editor, opening multiple Apply SQL Script to Database dialogues and then executingone, except for the last one opened, would crash MySQL Workbench. (Bug #61988, Bug #12918227)

• Importing a dump would misquote the --defaults-extra-file option, which would cause the importto fail. (Bug #61910, Bug #12912786)

• On Mac OS X, switching from the Model tab to the EER Diagram tab caused an error sound. (Bug#61809, Bug #12757337)

• While double clicking an arrow to expand a table from within the object browser, to see its columns, thearrow disappeared and the table could not be expanded. (Bug #61124, Bug #12736804)

• On Linux, MySQL Workbench would fail to open, because it could not load the MySQL Diff Reportingmodule. (Bug #61304, Bug #12613921)

• MySQL Workbench would sometimes crash while in Forward Engineering mode. (Bug #60950, Bug#12572071)

• If a schema within the schema panel was clicked, then a table was also clicked (dropped down) withinthe schema, then the panel containing Actions, Schemas, and details would expand to fill half of the viewwindow, and the size could not be adjusted. (Bug #60692, Bug #12587848)

• Using MySQL Workbench could result in an unhandled exception, with the message "Attempted to reador write protected memory. This is often an indication that other memory is corrupt." (Bug #56034, Bug#11763338)

• The Generate INSERT Statements for Tables option would not generate INSERT statements for BLOGcolumns. (Bug #60657, Bug #12565791)

Page 350: MySQL Workbench

Changes in Release 5.2

342

• Pressing Execute after double clicking and editing a field in select all mode, resulted in anunhandled exception. (Bug #61279, Bug #12627523)

• MySQL Workbench did not fully adhere to locale settings, which could result in unhandled exceptions.(Bug #56869, Bug #11764077)

• MySQL Workbench could crash while restoring large files. (Bug #61365, Bug #12627685)

• Pressing Esc once now escapes out of edit mode within the row editor. Before, it had to be pressedtwice. (Bug #60131, Bug #11829997)

• Exporting SQL for tables that included comments would generate invalid SQL statements. A comma wasmissing immediately before the COMMENT. (Bug #61393, Bug #12627762)

• Auto-scrolling for the SQL output and history windows was added. (Bug #55865, Bug #11763183)

• MySQL Workbench would allow the creation of foreign keys on tables using engines that do not supportthem. A warning is now emitted if this is attempted. (Bug #57875, Bug #11764972)

• Open diagram tabs from a saved MySQL Workbench state were not saved properly. (Bug #60515, Bug#12617096)

• Server Administration, Manage Import/Export would return an error about the dump module. (Bug#58098, Bug #11765164)

• The Foreign Keys tab of the Alter Table wizard only created an index, without the foreign key. (Bug#56818, Bug #11764033)

• On Linux, viewing the embedded documentation required the python-sqlite2 package. (Bug #60336, Bug#11874507)

• Closing MySQL Workbench would not prompt to save unsaved work from modified SQL files andwindows. (Bug #60557, Bug #11926868)

• On Linux and Mac OS X, using Tab and Shift+Tab to jump to next/previous fields has been added tothe query result view. It had previously only worked on Windows. Additionally, the Escape key will nowcancel editing of the current cell, and PageUp/PageDown scrolls one page up and down in the result set.(Bug #60865, Bug #12368205)

• The Advanced Export Options preferences were not saved, and would reset after restarting MySQLWorkbench. (Bug #60497, Bug #11889197)

• The Clear script output and Close this script tab buttons are now disabled in non-script tabs. (Bug#61318, Bug #12616331)

• The SQL editor output tab did not report the number of affected rows. (Bug #60535, Bug #12617147)

• On Mac OS X, Command+W will now close the active script editor tab, and Command+Shift+W willnow close the active connection tab. This is now consistent with behavior on other operating systems.Before, the Command+W combination closed the active connection tab. (Bug #60253, Bug #11829750)

• Executing a slow query would not notify the user that the query was running. The new SQL editorinterface does show the progress. (Bug #61231, Bug #12589710)

• Manipulating multiple SQL editor tabs would sometimes result in uncaught exceptions. (Bug #60764,Bug #12621640)

• MySQL Workbench would crash when attempting to use Alter Table or Create Table from within thecontext menu. (Bug #60760, Bug #12621510)

Page 351: MySQL Workbench

Changes in Release 5.2

343

• After opening a saved model file, the Control+T shortcut would not work from within a query window.(Bug #61379, Bug #12627716)

• On Linux, code folding for stored procedures and loops did not work properly within the SQL editor. (Bug#61302, Bug #12612394)

• The Synchronize model with Database wizard would not properly handle case-sensitive tablenames. (Bug #60523, Bug #12617135)

• The default schema selection would be lost after synchronizing a model. (Bug #60975, Bug #12621744)

• Connection and query tabs can now be reordered, by dragging and dropping with the mouse pointer.(Bug #60409, Bug #11865602)

• When hovering the mouse pointer over a table figure on a diagram, the foreign key tooltip would hide thetable column names. (Bug #61055, Bug #12546715)

• Factory snippet files were fixed, to include proper line-endings for all platforms. (Bug #60643, Bug#12621434)

• The USE statement is now properly quoted. For example, an invalid USE query would be generated if aschema contained a - character. (Bug #59882, Bug #11766711)

• Copying a table column would lose the data type, when only the column line number was selectedinstead of the data type or field name. (Bug #59285, Bug #11905520)

• On Microsoft Windows, the Find option (Control+F) for the SQL editor was not available. (Bug #61233,Bug #12622697)

• Editor windows would sometimes lose focus, but they are now docked within the main applicationwindow, which eliminated this problem. (Bug #55923, Bug #11763235)

• Enabling the Limit Rows SQL editor preference would cause invalid SQL syntax with SELECT INTOstatements. (Bug #58732, Bug #11765738)

• Within a server instance administration panel, setting Export to Self-Contained File to an invalid pathresulted in an unhandled exception. (Bug #59246, Bug #11766194)

• The Find feature (search) was replaced with a panel, which offers more consistent behavior acrossplatforms. The Find and Replace feature is also now a panel, instead of a pop-up window. (Bug #54765,Bug #11762197)

• The Copy Row Content option would throw an unexpected exception, from within a model.

In addition, the Paste Row option was added. (Bug #60116, Bug #12417533)

• When viewing text at a size greater than 100% (such as 125%), some text field labels would be partiallyhidden. (Bug #58408, Bug #12628507)

• The Object editors (such as Alter Table, Alter View, and Alter Routine) now open as tabs, instead ofseparate wizard windows. (Bug #61422, Bug #12642157)

• Fixed a crash bug, which would happen on exit. (Bug #60733, Bug #12632325)

• The Output tab of the SQL editor now adjusts whitespace characters, as to display queries on a singleline. (Bug #58989, Bug #11765966)

• Broken views (e.g., a column no longer exists) are now displayed as broken within the schema tree view.(Bug #56701, Bug #11763928)

Page 352: MySQL Workbench

Changes in Release 5.2

344

• On Linux, the previously set window positions and sizes were not saved by MySQL Workbench. Thesesettings are now saved upon closing, and used when MySQL Workbench is loaded. (Bug #54025, Bug#11761521)

• Selecting a schema with a large number of tables (e.g., 200+) would indicate that the schema wasempty. (Bug #49291, Bug #11757270)

• The Finish button was inactive (grayed out) for the Edit Table Data dialog, if the database containedexactly one table. (Bug #52833, Bug #11760422)

• If a table cannot be edited (e.g., no Primary key), then MySQL Workbench now notifies users of thereason, when before the edit option was simply not available. (Bug #51563, Bug #11759263)

• Closing and opening the SQL Editor now sets the last used schema as the default, instead of theschema specified within the connection. (Bug #51454, Bug #51026, Bug #11759165, Bug #11758776)

• A triple-click was required to change the Referenced column of a foreign key, while editing a tablewithin an EER diagram. (Bug #50725, Bug #11758512)

Changes in MySQL Workbench 5.2.35 (23 September 2011)

This section documents all changes and bug fixes applied to MySQL Workbench since the release of5.2.34.

Functionality Added or Changed

• On Microsoft Windows, the standard (common) keyboard and mouse shortcuts that control zoom werenot fully implemented. Usage: Control++ to zoom in, Control+- to zoom out, and Control+/ to reset to100%. (Bug #57463, Bug #11764608)

• The Copy Insert Template to Clipboard option was added to the Model View. For more information, seeFigure 7.7, “A Table on an EER Diagram”. (Bug #54887, Bug #11762310)

• Usernames and schemas can now be sorted. (Bug #55318, Bug #11762692)

• The query history is now saved between Workbench sessions. (Bug #51388, Bug #11759102)

Bugs Fixed

• The Administrator now allows various authentication plugins (such as Windows Auth, PAM) to createuser accounts.

The dropdown for the authentication method will only be displayed if MySQL Workbench detects thatadditional authentication plugins are enabled by the server. (Bug #12899893)

• The unused Start MySQL Utilities Shell for Connection connection menu item was removed. (Bug#12898126)

• MySQL Workbench would sometimes crash after opening multiple EER diagrams. (Bug #12875254)

• The Create EER Model from Existing Data Base process would incorrectly report that the schema wasempty. (Bug #12875126)

• The is_enabled() method was added to the mforms View class. (Bug #62140, Bug #12860149)

• The database connection splash screen would freeze after opening a server administration instance. Itwould work perfectly the second time. (Bug #61693, Bug #12756623)

• MySQL Workbench crashed with a segmentation fault after the connection step of a modelsynchronization. (Bug #61822, Bug #12742008)

Page 353: MySQL Workbench

Changes in Release 5.2

345

• The Synchronize with Any Source option reversed the 'destination' and 'source' database nameswithin the generated SQL statement. (Bug #62189, Bug #12921676)

• On Mac OS X, an unchanged MWB file would prompt to save after exiting, and then crash after selectingYes. (Bug #61547, Bug #12668099)

• On Mac OS X, connecting to remote servers using SSH tunnels failed to connect. The workaround wasto manually test the connection first, via the Manage Connections menu. (Bug #61537, Bug #12674397)

• MySQL Workbench would crash when pressing Apply to an empty SQL field under the Review theSQL Script to be Applied to the Database form, the second time, after selecting Go Back.(Bug #61632, Bug #12694149)

• Viewing the Admin Management option Server Logs with an empty TABLE resulted in an unhandledexception. (Bug #61523, Bug #12674989)

• On Mac OS X, disabling the Enable data changes commit wizard preference setting would not disablethe wizard. (Bug #61354, Bug #12616314)

• MySQL Workbench would not load the configuration options with MariaDB due to version numberdifferences between MariaDB and MySQL. (Bug #61219, Bug #12605404)

• Closing MySQL Workbench would not prompt to save SQL Editor scratch tabs. (Bug #58899, Bug#11765889)

• It was not possible to drop multiple selected tables or schemas. (Bug #55688, Bug #11763027)

• Creating, then selecting or removing user accounts with invalid hosts (such as '%', including the singlequotes) resulted in an unhandled exception. (Bug #61244, Bug #12580053)

• Under certain circumstances, closing a query window would not prompt to save the query. (Bug #61160,Bug #12565971)

• Create EER Model, Schema Privileges, Add Role, Privileges, and then Uncheck All Privilegescaused MySQL Workbench to crash. (Bug #61308, Bug #12613935)

• MySQL Workbench would not connect to multiple database connections when the sql_history folderwas too large. A workaround was to delete the sql_history folder. (Bug #59520, Bug #11766417)

• The MySQL Workbench SE MySQL Bug Reporter linked to bugs.mysql.com instead ofsupport.oracle.com. (Bug #60364, Bug #11872318)

• The SQL Editor History could not be saved when the username contained Unicode characters. Thiswas due to MySQL Workbench attempting to save files using an invalid file path. (Bug #59215, Bug#12403539)

• On Microsoft Windows, expensive queries caused MySQL Workbench to be unresponsive after otherapplications were made active, and the MySQL Workbench wizard was running. This meant that themain MySQL Workbench window could not be selected. (Bug #61122, Bug #12543271)

• The SQL Editor Output, History window contained escaped characters. For example, a "'" was writtenas "&apos;". (Bug #61345, Bug #12605093)

• On Microsoft Windows, a MySQL Workbench Unexpected Error dialogue is generated when using twoSQL Editor windows each with their own database connection to the same server. (Bug #61367, Bug#12612181)

• On Microsoft Windows, the following scenario generated an error and a bogus SQL editor tab uponMySQL Workbench restoration: Having multiple open SQL Editor tabs, closing the first, and then closing

Page 354: MySQL Workbench

Changes in Release 5.2

346

the database connection (while the Auto-save scripts interval option is enabled). (Bug #60569,Bug #12617215)

• On Mac OS X, the Operation in progress dialogue would stall when using database connectionsfrom older versions of MySQL Workbench. The workaround was to move the mouse. (Bug #61416, Bug#12627853)

• On Linux, the Reverse Engineer Database, Select Objects to Reverse Engineer dialogue contained amenu titled label. (Bug #61327, Bug #12600868)

• MySQL Workbench would not compile with GNU C Compiler (GCC) version 4.6. (Bug #60603, Bug#12617226)

• The Find Plugin in Web Repository option was removed from the MySQL Doc Library action. (Bug#61305, Bug #12613922)

• The Management, Server Logs, Slow Query Log view resulted in an unhandled exception after theinitial Newest button usage. (Bug #58810, Bug #11765808)

• The SQL Editor Overview tab did not refresh after a schema was deleted. (Bug #61314, Bug#12616355)

• The Object Browser now automatically refreshes after an object is changed. (Bug #56704, Bug#11763930)

• On Microsoft Windows, installation of 5.2.34 over 5.2.33 would sometimes fail due to file collisions, andwould then crash at startup. (Bug #61296, Bug #12600117)

• Copy Insert to Clipboard now updates the MySQL Workbench status to say “The table schema.tablehas no records for insert statements” when no inserts are defined for the table. (Bug #54887, Bug#11762310)

• On Ubuntu Linux, MySQL Workbench crashed with a segmentation fault when executing the View,Output combination twice. (Bug #61303, Bug #12601189)

• The query beautifier added superfluous identifier quote characters to the end of some queries. (Bug#60576, Bug #11926859)

Changes in MySQL Workbench 5.2.34 (26 May 2011)

This section documents all changes and bug fixes applied since the release of 5.2.33.

This release changed the version of Python version in MySQL Workbench to 2.7. However, this producesa problem when upgrading from 5.2.33. The reason is that the installer leaves all the compiled pythonfiles (*.pyc) in the installation folder. The next time MySQL Workbench loads, you cannot get beyond thesplash screen.

As a workaround, uninstall MySQL Workbench before you install 5.2.34. (This will not do anything to yourstored connections, starters, settings, and so forth.) Make sure that all compiled python files (*.pyc) havebeen removed from the installation folder after uninstallation is finished, before you install 5.2.34.

This problem was first encountered on Windows using the MSI package, but might also affect the Zippackage or even other platforms. In any case, remove the old files before installing 5.2.34.

Functionality Added or Changed

• Canceling a query used to work by dropping the connection. Now only the query itself is canceled. (Bug#12394153)

Page 355: MySQL Workbench

Changes in Release 5.2

347

• MySQL Workbench now writes the wb.log file in the .mysql/workbench directory rather than in ~(your home directory). (Bug #60930, Bug #12548457)

• On Windows, it is possible to open multiple models, but it was not clear that enabling this preferencerequires a MySQL Workbench restart. The check box tooltip now indicates this. (Bug #59400, Bug#11766312)

• A Check for Updates feature was added. (Bug #56612, Bug #11763846)

• In diagram mode, display of triggers for tables was re-enabled. (Bug #57956, Bug #11765044)

• If a column value is too long to display, an ellipsis (...) is displayed at the end to indicate that there ismore data. (Bug #55976, Bug #11763283)

• If MySQL Workbench finds that .NET is not installed, it now provides a link for the user to get the .NETinstaller. (Bug #55145, Bug #11762538)

• The Check for updates... menu item that was removed several releases ago has been restored.(Bug #60488, Bug #11879029)

• Toggle Page Guides is no longer available. (Bug #49927, Bug #11757824)

• The SQL Editor can now wrap long text lines. This is controllable per editor instance using its contextmenu. By default, line wrapping is off. (Bug #50569, Bug #11758372)

• MySQL Workbench now shows query execution time and query warnings. (Bug #51199, Bug#11758933, Bug #58333, Bug #11765373)

• Added the ability to see differences of compared schema objects, when the database synchronizationwizard is executed. (Bug #42844, Bug #11751838)

Bugs Fixed

• A SHOW WARNINGS query would return zero results, even when warnings existed. (Bug #59221, Bug#11766174)

• On Ubuntu Linux 11.04+, part of the main MySQL Workbench menu would be hidden when utilizing theUbuntu Unity display handler. Therefore, the Unity style menus have been disabled. (Bug #61256, Bug#12581792)

• Fixed a possible crash when selecting File, Export, Forward Engineer SQL CREATE Script, and followedby the browse button. (Bug #60626, Bug #12617320)

• These query beautifier problems were corrected:

• Queries containing table aliases were mishandled.

• Spaces between table names and table aliases were incorrectly removed.

(Bug #60742, Bug #11883490, Bug #12327013)

• MySQL Workbench could crash while applying an SQL script to a database. (Bug #60966, Bug#12608789)

• Create EER Model from SQL Script reported a syntax error when importing legal SQL scripts. (Bug#59577, Bug #11766464)

• In the Python workbench shell, files with a nonsupported execution generated a warning and could notbe run. (Bug #60815, Bug #12561562)

Page 356: MySQL Workbench

Changes in Release 5.2

348

• Refreshing the Object Browser collapsed the browser tree. (Bug #60887, Bug #12366813)

• Clicking the Manage Security link in the MySQL Workbench Home screen opened the Admin screen inthe Startup tab rather than the Accounts tab and produced an error. (Bug #59389, Bug #11766302)

• Some MWB files created in MySQL Workbench 5.1 could not be loaded in 5.2. (Bug #59862, Bug#11766695)

• Executing an SQL script using the scripting shell is not supported, but attempts to do so resulted in aMySQL Workbench crash rather than an error. (Bug #60977, Bug #12402780)

• MySQL Workbench lost the connection to the server for long-running queries (more than 600 seconds).(Bug #60103, Bug #11766876)

• A memory leak occurred during diagram manipulation. (Bug #55719, Bug #11763054)

• On Windows, opening a second instance of MySQL Workbench resulted in an error. (Bug #59128, Bug#11766090)

• Selecting the Create Multiple Tables menu item resulted in an error. (Bug #59586, Bug #11766473)

• MySQL Workbench displayed superfluous error messages after the user interrupted a query. (Bug#59323, Bug #11766255)

• MySQL Workbench sometimes looked for my.ini in the wrong directory. (Bug #60076, Bug #11766855)

• With a large table displayed in the SQL Editor object browser, keyboard shortcuts for the tableinformation display were not working, and the information was not formatted properly. (Bug #54191, Bug#11761676)

• MySQL Workbench tries to determine whether it can use Aero, but did not correctly check the platform.On Windows Server 2003, a call was made to a non-existing DLL, causing a .NET crash. (Bug #60412,Bug #11872360)

• A problem running MySQL Utilities under the KDE console was fixed. (Bug #59427, Bug #12430837)

• When a schema was dropped in the Object Browser view using the context menu, the view was notrefreshed properly. (Bug #60688, Bug #11933806)

• When the SQL statement history file became large enough, MySQL Workbench encountered allocationerrors attempting to add to it. (Bug #58778, Bug #12409656)

• If a connection name contained a ':' character, it did not work. (Bug #60700, Bug #12325493)

• MySQL Workbench crashed if it was unable to locate a required DLL due to security blocking. Now itdisplays instructions to the user how to perform unblocking. (Bug #60658, Bug #12545324)

• Control+Z in the Model Editor did not always refresh the screen correctly. (Bug #59661, Bug#11766531)

• After using the column headers of the User Accounts list to sort the accounts by User or From Host,then selecting various accounts in turn, the selected accounts often did not match the account beingdisplayed in the corresponding Login, Administrative Roles, or Account Limits tabs. (Bug #59391, Bug#11766304)

• MySQL Workbench did not assign a correct tab name when opening an SQL script from the recent filelist menu. (Bug #60610, Bug #11926855)

• Some color schemes made options difficult to read. (Bug #60826, Bug #12368221)

Page 357: MySQL Workbench

Changes in Release 5.2

349

• Exporting a record set to a file resulted in invalid INSERT statements if the table contained a columnnamed key because the column name was not quoted properly. (Bug #59787, Bug #11766638)

• EER Diagram Catalog Tree schema folders did not stay collapsed when moving tables from a schema tothe Diagram. (Bug #55088, Bug #11762487)

• Using the Description Editor to update a table description did not update the Comments column of theModel Overview window. (Bug #55235, Bug #11762621)

• Actions that should open a web page did not work. (Bug #54827, Bug #11762254)

• Several crashes occurred under KDE with certain GTK+ themes. (Bug #60640, Bug #11926917)

• It was not possible to import a dump if MySQL Workbench was installed in a directory having a namethat contained spaces. (Bug #59737, Bug #11766595)

• Items from the SQL Editor history were not always available to be copied into the SQL script. (Bug#59807, Bug #1766651)

• When the user closed the main window with a connection active, MySQL Workbench did not terminatethe connection. This lead to Aborted_clients errors on the server side. (Bug #58944, Bug#11765929)

• On Linux, MySQL Workbench was overly aggressive about reading schema information fromINFORMATION_SCHEMA, leading to slowdowns when connecting to the MySQL server. Now informationis read only for the default schema. (Bug #60644, Bug #11926793)

• The Users column in the Schema Privileges tab was not sortable. (Bug #59138, Bug #11766100)

• Multiple USE statements to change databases in the SQL Editor caused MySQL Workbench to crash.(Bug #60856, Bug #12358480)

• When double-clicking tables in a model diagram, tabs were mismanaged such that the proper set of tabsdid not remain available. (Bug #57349, Bug #11764509)

• Connection sorting was lost after a status refresh. (Bug #59355, Bug #11766279)

• On Mac OS X, two-finger scrolling did not work in query windows. (Bug #53678, Bug #11761211)

• Output from the routine editor added excessive blank lines between routine definitions. (Bug #60205,Bug #11874345)

• The SQL statement generated by clicking an item in the action pane failed to include the qualifyingdatabase name. (Bug #60562, Bug #11926864)

• MySQL Workbench could crash trying to display result sets that contained binary data. (Bug #60588,Bug #12385959)

• New server instances were not always displayed in the Server Administration list. (Bug #60684, Bug#11933087)

• The Administrator panel would not load for large process ID values of the MySQL server. (Bug #60505,Bug #12397312)

• Forward Engineer SQL Script wizard wrote incomplete output. (Bug #60751, Bug #12329302)

• MySQL Workbench failed to compile on Gentoo Linux. (Bug #60358, Bug #12368202)

• MySQL Workbench could not view the server logs if the server was configured with log output set to'TABLE,FILE'. (Bug #60853, Bug #12365454)

Page 358: MySQL Workbench

Changes in Release 5.2

350

• File import operations failed with these errors:

Error executing task: 'module' object has no attribute'STARTF_USESHOWWINDOW' Error executing task local variable 'p1' referenced beforeassignment

(Bug #60982, Bug #12430815)

• Changing connection parameters in Synchronize Model resulted in an error message. (Bug #60771, Bug#12329285)

• On Mac OS X, Option+Delete functioned as Undo rather than deleting the word to the left of the cursor.(Bug #57184, Bug #11764360)

• Record set export to a file failed unless the file name was given as an absolute path name. (Bug #60256,Bug #11874435)

• Stored procedures could not be opened from the objects tree if the SQL Delimiter had been changed tothe ';' character. Now the label for this option in the Preferences dialog has been changed to NonStandard SQL Delimiter to better reflect its actual meaning. The tooltip has also been changedto be more descriptive. In addition, if an Alter <object>... operation fails due to a parse error, theretrieved DDL code is shown as is in the SQL editor. (Bug #60354, Bug #11889184)

• For import and export command operations using a Unix socket file, MySQL Workbench added anincorrect --pipe option to the command. (Bug #60756, Bug #12325422)

• Find did not work in Query tabs. (Bug #60787, Bug #12347063)

• Query results could not be saved to a directory for which the name contained Japanese characters. (Bug#60438)

• Exporting query results after entering a file path name did not work. (Bug #60438, Bug #11868335)

• Multiple-selection copy did not work. (Bug #60410, Bug #11865601)

• Attempting to connect to a nonexistent server put MySQL Workbench in a nonresponsive state. (Bug#60329, Bug #11834154)

• Clicking a user name to obtain details caused MySQL Workbench to crash if the name contained anapostrope. (Bug #60473, Bug #11889207)

• When database connections had process IDs with large values, the connection tab displayed an errorbox rather than process information. (Bug #60192, Bug #12397794)

• Control+S did not save models or SQL Editor scripts. When opening an SQL script, it did not display thefile name. (Bug #60594, Bug #12402774)

• MySQL Workbench crashed trying to execute some CREATE TABLE statements. (Bug #60475, Bug#12356405)

• Opening a connection twice resulted in unexpected errors when executing queries on the connection.(Bug #58835)

• The description given in the Workbench Preferences dialog for the --safe-updates option wasincorrect. (Bug #59370, Bug #11766289)

• On Mac OS X, the Shift+Alt + Arrow combination selected individual characters instead of words. (Bug#50085, Bug #11757963)

Page 359: MySQL Workbench

Changes in Release 5.2

351

• The live schema tree did not update properly to reflect modifications to schema objects. (Bug #50424,Bug #11758248)

• For data browsing, the Fetch All option sometimes disappeared. (Bug #49403, Bug #11757365)

• After loading a model, zoom levels saved with bookmarks were not always used correctly. (Bug #50816,Bug #11758594)

• Dragging tables from the catalog to an EER diagram failed. (Bug #47028, Bug #11755277)

• Opening a connection from the list of recently used connections caused the user interface to becomeunresponsive while wanting for the connection to open. Now a “Connecting, please wait” messageappears and there is a Cancel button to enable the connection request to be canceled. (Bug #48912,Bug #11756924)

• On Windows, a packaging error for the Zip file distribution led to spurious GRT Shell warnings at MySQLWorkbench startup. (Bug #49813, Bug #11757719)

• For SQL Editor tabs where the connection had no name, connection information was not shown. NowMySQL Workbench displays the host name (up to 21 characters). (Bug #49058, Bug #11757060)

• It was not possible to view or edit long text lines with the inline editor. (Bug #52087, Bug #11759751)

• The TRIGGER privilege could not be assigned at the schema level. (Bug #52977, Bug #11760556)

Changes in MySQL Workbench 5.2.33b (21 March 2011)

This section documents all changes and bug fixes applied since the release of 5.2.33.

Bugs Fixed

• Creating a relationship broke the model file due to the index and foreign key having the same name.(Bug #60564, Bug #11926856)

• Attempting to open a saved model produced this error:

Error unserializing GRT Data. Expected Type db.mysql.Column, but got db.mysql.Table.

(Bug #60369, Bug #11840427)

Changes in MySQL Workbench 5.2.33 (11 March 2011)

This section documents all changes and bug fixes applied since the release of 5.2.32.

Bugs Fixed

• The Reformat SQL Query option would sometimes fail, and emit an error. (Bug #58856, Bug #11765852)

• The query beautifier failed for queries containing subqueries. (Bug #58835, Bug #11765832)

• The ability to synchronize non-model sources was added. (Bug #60009, Bug #11766805)

• It was not possible to forward engineer a model, or synchronize it with a live model. (Bug #60396, Bug#11850052)

• In the Administrator, when Manage Security was selected, an error message was displayed in thestatus bar. It was not then possible to see and therefore manage user privileges. (Bug #60370, Bug#11840439)

Page 360: MySQL Workbench

Changes in Release 5.2

352

• In the Users and Privileges task of the Administrator, it was not possible to sort the usersalphabetically. (Bug #56456, Bug #11763710)

• MySQL Workbench would incorrectly report that the MySQL server had stopped. (Bug #51146, Bug#11758886)

Changes in MySQL Workbench 5.2.32 (05 March 2011)

This section documents all changes and bug fixes applied since the release of 5.2.31a.

Functionality Added or Changed

• Changing the default schema now modifies the selected schema name to be bold. (Bug #57710, Bug#11764836)

• In the SQL Editor, in the event of a crash, the content and state of script tabs was lost if not previouslysaved. MySQL Workbench now autosaves the content and state of the SQL Editor. (Bug #57667, Bug#11764794)

• MySQL Workbench has been improved so that an errors are more clearly identified if they occur whensynchronizing with a live server, or forward engineering to a live server. (Bug #55158, Bug #11762551)

Bugs Fixed

• These query beautifier problems were corrected:

• Aggregate function text was deleted.

• In the SQL Editor, the beautifier did not process functions such as COUNT() or NOW() or correctly. Itrendered the function with additional spaces, causing a syntax error.

(Bug #60070, Bug #11766850, Bug #59450, Bug #11766354, Bug #58714, Bug #11765722)

• Primary and foreign keys are now displayed with different icons. (Bug #53503, Bug #11761049)

• MySQL Workbench crashed when closing the query results tab in the SQL Editor. (Bug #59774, Bug#11766626)

• In the SQL Editor, switching between query tabs did not switch the associated results panel. (Bug#57486, Bug #11764628)

• The text in the SQL Editor was not anti-aliased, which hindered readability by causing the text to visuallyconflict with anti-aliased text elsewhere in MySQL Workbench. (Bug #54059, Bug #11761553)

• When deleting a recursive foreign key constraint, the primary key was also mistakenly deleted. (Bug#59668, Bug #11766538)

• In the SQL Editor, if a '`' (grave accent) character was entered, any subsequently entered control keyssuch as the arrow keys or the backspace key failed to function correctly. (Bug #59528, Bug #11766425)

• Generated scripts did not manage connection variables cleanly. For example, the autocommit statewas not preserved by the script produced by forward engineering an SQL CREATE script. The scriptswitched off autocommit, but did not then restore it correctly to its previous state. (Bug #58998, Bug#11765974)

• When synchronizing a model with a server, indexes were unnecessarily dropped and recreated. (Bug#58238, Bug #11765284)

Page 361: MySQL Workbench

Changes in Release 5.2

353

• Forward engineering a model containing two schema resulted in a generated script that containedincorrect SQL:

DELIMITER ;USE `Schema2` ;

The DELIMITER and USE statements should not have appeared on the same line. (Bug #58117, Bug#11765180)

• In the Columns tab of the table editor, copying and pasting the Datatype field using Control+C andControl+V resulted in the text “table_copy1” being pasted, rather than the copied datatype. (Bug#56501, Bug #11763749)

• When forward engineering a model, the generated script resulted in SQL errors when executed on theserver. This happened when the following options were selected:

• DROP Objects Before Each CREATE Object

• Omit Schema Qualifier in Object Names

• Generate Separate CREATE INDEX Statements

• Generate INSERT Statements for Tables

(Bug #54836, Bug #11762262)

• The generated alter script contained erroneous statements adding and deleting indexes and foreignkeys. (Bug #54180, Bug #11761666)

• In the EER Diagram view, clicking a table to edit its details sometimes resulted in this error:

Cannot access a disposed object.Object name: 'DockedWindowPlugin'

(Bug #59559, Bug #11766448)

• When a model was forward engineered, the primary keys were not created in the generated script. (Bug#58926, Bug #11765913)

• When exporting a model, if the Skip Creation of FOREIGN KEYS option was selected, indexes werenot created. (Bug #56389, Bug #11763649)

• In the EER Diagram view, MySQL Workbench crashed on selecting a new table. This happened if thePrivileges tab was open for the currently selected table. (Bug #59535, Bug #11766431)

• In the Administrator, when making a backup with the --single-transaction option enabled, the --lock-tables option was erroneously still enabled. (Bug #58562, Bug #11765579)

• Attempting to create a new server instance resulted in this error message:

We are sorry for the inconvenience but an unexpected exception hasbeen raised by one of the MySQL Workbench modules. In order to fixthis issue we would kindly ask you to file a bug report. You cando that by pressing the [Report Bug] button below.

(Bug #59578, Bug #11766465)

• At startup, MySQL Workbench displayed a blank screen if it had previously been closed after using themenu item Help, System Info, and then clicking the main application window close button. (Bug #55764,Bug #11763097)

Page 362: MySQL Workbench

Changes in Release 5.2

354

• On Microsoft Windows, if the Windows Firewall application was not running, installation of MySQLWorkbench would halt with an error dialog indicating that it was unable to connect to the firewall. (Bug#53603, Bug #11761143)

• On Windows, the Python debugger stopped the script being executed in MySQL Workbench after aboutone second. It then displayed the message "abort" in the output pane. (Bug #58960, Bug #11765943)

• On Microsoft Windows 7, if a user profile launched MySQL Workbench, it crashed if additional userprofiles attempted to launch it. The first instance needed to be closed before another user profile wasable to run MySQL Workbench. (Bug #59913, Bug #11766733)

• On the Home screen, right-clicking a connection and selecting Start Command Line Client produced thiserror:

Error callingPyWbUtils.startCommandLineClientForConnection: seeoutput for details

output: Message: Error executing plugin wb.tools.comdlineClient:error calling wb.tools.cmdlineClientTraceback: File "C:\Program Files\MySQL\MySQL Workbench 5.2 CE\modules\wb_utils_grt.py", line 96, in startCommandLineClientForConnection

schema = conn.parameterValues["schema"].replace("\\", "\\\\").replace('"', '\\"')AttributeError: 'NoneType' object has no attribute 'replace'

(Bug #59638, Bug #11766510)

• When running MySQL Workbench with the arguments “-script [FILE.lua] -quit-when-done”, it crashedwith this message:

[MySQL Workbench Unexpected Error]

MySQL Workbench has encountered a problem

Cannot access released / disposed object. Object name: "MainForm".

(Bug #57570, Bug #11764708)

• Trying to create a relationship between two tables, created in a plugin, produced this error:

MySQL Workbench has encountered a problemEs wurde versucht, im geschützten Speicher zu lesen oder zu schreiben. Dies ist häufigein Hinweis darauf, dass anderer Speicher beschädigt ist.

(Bug #58554, Bug #11765571)

• In the SQL Editor, when editing table data, this error dialog was displayed:

Either schema or table is not selected.

Each time the dialog was acknowledged, it was subsequently redisplayed, preventing further progress.(Bug #57127, Bug #11764305)

• Attempting to create a new user with MySQL Workbench failed with this error:

Unhandled exception: Error adding account accountName@%:

Page 363: MySQL Workbench

Changes in Release 5.2

355

(Bug #59000)

• The collapsed state of Workbench Central, on the Home screen, was not saved between MySQLWorkbench sessions. If after collapsing Workbench Central to save vertical space, the application wasexited and restarted, Workbench Central was drawn in the expanded state. (Bug #59399)

• Running the version of mysqldump supplied with the MySQL Server package resulted in this error:

Operation failed with exitcode -1073741819

(Bug #59411)

• SQL Editor did not load certain text files correctly, and inserted erroneous empty lines between text.(Bug #58850)

• Dropping a table from the Object Browser did not remove the table's icon. (Bug #52878, Bug#11760462)

• There were numerous locations within MySQL Workbench where the availability of context-sensitivemenus (right-clicking) was expected and useful, but not available. (Bug #49622, Bug #11757556)

• Forward engineering a table containing a multiple-line comment resulted in this error:

ERROR 1105 (HY000) at line 97: Too long comment for table 'motd'

(Bug #38597)

Changes in MySQL Workbench 5.2.31a (13 December 2010)

This section documents all changes and bug fixes applied since the release of 5.2.31.

Functionality Added or Changed

• It was not possible to launch the MySQL Command Line Client from the SQL Editor. MySQL Workbenchhas been changed so that it is now possible to launch a MySQL Command Line Client from the Homescreen. This can be done through the context-sensitive menu available for items listed in the connectionslist on the Home screen. (Bug #56631)

Bugs Fixed

• SQL Editor did not load certain text files correctly, and inserted erroneous empty lines between text.(Bug #58850)

• Opening the Snippets tab in the SQL Editor caused MySQL Workbench to crash with the error:

** Message: query.explain built-in command is being overwrittenmysql-workbench-bin: /usr/include/boost/smart_ptr/shared_ptr.hpp:418: T*boost::shared_ptr< <template-parameter-1-1> >::operator->() const [with T = Sql_editor]:Assertion `px != 0' failed.Aborted

(Bug #58833)

• MySQL Workbench closed silently when the User Defined Types Editor dialog was closed using theclose button on the window frame, or by pressing Alt+F4. (Bug #58846)

• An unexpected error was generated when attempting to modify the script created in the ForwardEngineer to Database wizard. (Bug #58893)

Page 364: MySQL Workbench

Changes in Release 5.2

356

Changes in MySQL Workbench 5.2.31 (08 December 2010)

This section documents all changes and bug fixes applied since the release of 5.2.30.

Functionality Added or Changed

• The query execution time was added to the query result status bar. (Bug #53509, Bug #11761054)

• Edit, Format, Un/Comment Selection was added. (Bug #55278, Bug #11762657)

• MySQL Workbench has been changed so that holding the spacebar while in the EER Diagram viewtemporarily changes the cursor to the hand tool. When the spacebar is released the cursor reverts to thetool that was selected prior to the spacebar having been pressed. (Bug #52331)

Bugs Fixed

• MySQL Workbench would not detect invalid values while they were entered into the properties editor.(Bug #11749933)

• These query beautifier problems were corrected:

• When the beautifier was used on a query that performed a join with the USING keyword, the tablename was concatenated with that keyword.

• The beautifier did not recognize the optional AS keyword in table references. When AS was used witha table alias, the beautifier concatenated that keyword and the alias, which caused any references tothe original alias to fail.

• Using the beautifier on a query containing USING resulted in an invalid query being generated. Thiswas due to missing spaces around USING.

• Using the beautifier on a query resulted in an unhandled exception.

• If a query was partially selected, and then the beautifier was run, the results were unpredictable.Problems included exceptions, duplicated tokens, and incorrect indentation.

• When the beautifier was run on code containing several statements, the code was incorrectlyformatted.

• A query containing a CASE keyword was not handled correctly.

• The beautifier converted certain tokens to uppercase that should not have been converted.

• When attempting to beautify a CREATE INDEX query, the beautifier removed part of the query.

• If a query was written in the SQL Query tab, and then highlighted using the cursor, the beautifier failedwith an unhandled exception on calls to beautify, uppercase, or lowercase functions.

• Using the beautifier on a CREATE TABLE statement resulted in an unhandled exception.

(Bug #58598, Bug #58569, Bug #58347, Bug #58565, Bug #58359, Bug #58367, Bug #58361, Bug#58360, Bug #58357, Bug #58358, Bug #58356)

• In the SQL Editor, when entering a hex value into an INTEGER column, the hex value was automaticallyquoted as a string, causing it to be evaluated to 0. (Bug #58045)

• Generated INSERT statements did not include quote characters for TEXT or DATE columns. (Bug#54910)

Page 365: MySQL Workbench

Changes in Release 5.2

357

• When exporting a record set using the SQL INSERT statements file format, a number of issues werefound:

• The first line contained the executed SELECT statement as a comment but the LIMIT syntax waslocated in a new line. This resulted in the LIMIT part of the statement not being commented out.

• Strings following the VALUES keyword were not quoted.

• The INSERT statements contained the text “table” in place of the actual table name.

• Existing files were overwritten without prompting the user.

(Bug #58377, Bug #56950)

• In the SQL Editor, selecting the default database where the server contained only a single database hadno effect. To avoid a “No database selected” error, the database had to be selected in a script using theUSE statement. (Bug #58274)

• A script file that was converted to the cp850 character set was truncated on loading into the SQL Editor.(Bug #57636)

• In the SQL Editor, an out of memory exception occurred when exporting a large record set in the CSVfile format. (Bug #55889)

• In the SQL Editor, when viewing table data where the number of columns was such that some columnswere offscreen, if the End key was pressed to go to the last column in the row, the data grid did notscroll accordingly, so the column containing the cursor was not visible without manually scrolling. (Bug#54753)

• Results for queries on rows that contained a null byte (\0) were truncated at the null byte character whendisplayed in the SQL Editor results pane. (Bug #58099)

• In the SQL Editor, it was not possible to create a foreign key relationship between two tables. (Bug#55399)

• In the Model Overview, if a diagram had a title that wrapped to two lines or more, the second line wastruncated due to lack of space in the panel. Now MySQL Workbench includes a scrollbar should thediagram titles not fit within the standard panel. (Bug #54952)

• For a column of type TIMESTAMP, the menu items Default CURRENT_TIMESTAMP and DefaultCURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP in the context-sensitive menu of theColumns tab of the Table Editor were grayed out. This occurred where a preceding column of typeTIMESTAMP was allocated an explicit default value. MySQL Workbench should not have preventedsetting a value using the context-sensitive menu for the second defined column in this case. (Bug#57665)

• Forward engineering a model failed with a duplicate column name error when the EER diagramcontained a view consisting of tables joined using the JOIN ... USING syntax. (Bug #57329)

• In the Role Editor, the “Drag object from the catalog tree to assign privileges” text label was out of date.The label should have read “Drag objects from Physical Schemata section to assign privileges”. (Bug#56321)

• In the Reverse Engineer Database wizard, the ability to select the default schema on the ConnectionOptions page was superfluous. (Bug #56179)

• Deleting routine groups from the EER Diagram view did not delete routines. (Bug #56084)

Page 366: MySQL Workbench

Changes in Release 5.2

358

• In the Column tab of the Table Editor, it was possible to set NULL as the default value for a column thathad been specified as NOT NULL. (Bug #55456)

• In the Table Editor, if a data type was selected for a column, this was immediately reflected on the EERDiagram view. However, if the selection was reverted by pressing Control+Z, the EER Diagram was notupdated to reflect this, and continued to display the original data type. (Bug #55348)

• In the User Defined Data Types Editor, clicking the button to edit the argument list caused the ArgumentList Editor dialog to be drawn beneath the current dialog. As the dialog with focus could not beaccessed, this meant it was not possible to proceed with editing and MySQL Workbench had to beclosed. (Bug #55242)

• The Modified time displayed in the Model Overview was incorrectly set to the current time. (Bug#55237)

• It was not possible to select and copy messages in the Output window of MySQL Workbench. Whenmessages were displayed it was no longer possible to right-click them and select either the CopySelected Messages to Clipboard or the Clear Output Windows menu items. (Bug #54983)

• In the Diagram view switching between tables caused erroneous carriage returns to be added to theDDL code in the Triggers tab. (Bug #54411)

• ENUM values entered into the Inserts Editor were not automatically quoted. (Bug #57399)

• When objects were double-clicked in the Diagram view, the correct tab was not always switched to in theObject Editor. The Description Editor did however switch to the correct object. (Bug #55994)

• Backups dumped to a project folder (file per table) were restored in no particular order. This made itdifficult to resume a problematic restore at a specific point. (Bug #56897)

• In the Server Access Management tab of the Administrator no user accounts were displayed. Further,attempting to create a new account resulted in an exception. (Bug #57941)

• The error message displayed when the mysqldump version needed updating was not informativeenough. (Bug #54209)

• An error message contained a spelling mistake:

Line 437 of .\backend\wbprivate\workbench\wb_context_ui_home.cpp:std::string msg = strfmt("Error in sercurityManager module: %s",err.what());

(Bug #57684)

• Clicking the Configuration tab in the Administrator produced this error:

Error Opening Configuration FileException: Internal error. File data passed is not in expected format. This is a bug, wewould appreciate if you file a bug report at http://bugs.mysql.com.

(Bug #57418)

• In the Administrator, attempting to add an account with a login name longer than 16 characters resultedin an exception. (Bug #57300)

• When the MySQL service was set to manual in MySQL Workbench, the service was displayed asrunning in the server status panel, even though the service had not yet been started. (Bug #56919)

• In the Connections tab of the Administrator, scrolling did not work correctly with large numbers ofconnections. (Bug #56144)

Page 367: MySQL Workbench

Changes in Release 5.2

359

• When multiple tabs were open in the Administrator, with each connected to a different server, and withexport of a database was set up in each, running an export operation resulted in errors. This occurredbecause MySQL Workbench attempted to export a database selected in a tab other than the currentlyselected one. (Bug #56113)

• In the Configuration tab of the Administrator it was not possible to enable or disable thelocal_infile (LOAD DATA LOCAL) option. (Bug #55031)

• In the Administrator, starting or stopping the monitored server produced this error message:

Could not stop/start server: expected a character buffer object

(Bug #58400)

• In the Administrator, monitoring of a remote server did not work. (Bug #58586)

• If a MWB file was double-clicked to open, but MySQL Workbench was already running, a new instanceof MySQL Workbench was launched, rather than opening the file in a new tab in the currently runninginstance. (Bug #56067)

• Autotools were required to be installed locally to build MySQL Workbench from source. (Bug #58263)

• The MySQL Workbench tarball contained cached Autotools information. (Bug #58261)

• Typing into the Workbench Scripting Shell resulted in an Unexpected Error:

MySQL Workbench has encountered a problem.

Attempted to read or write protected memory. This is often an indication that othermemory is corrupt.

(Bug #58832)

• The MySQL configuration file could not be accessed during MySQL Workbench installation. (Bug#56987)

• When creating a new server instance, this error occurred when testing the settings:

Operation failed: File doesn't exist

(Bug #56911)

• Close tab functionality failed intermittently. This occurred for attempts to close the tab directly or whenusing the File, Close tab menu item. (Bug #55901)

• When setting the data type of a column to DOUBLE with precision specified, the data type reverted toDOUBLE without the desired precision specifiers. This happened in both the Table Editor and the SQLEditor. (Bug #57865)

• After the computer woke from the sleep state, MySQL Workbench attempted to reconnect to aconnection that had previously been closed in the SQL Editor. (Bug #56302)

• In the sidebar of the SQL Editor, when a default schema was selected, other schemas listed in thesidebar were not displayed. (Bug #55864)

• If the Table Editor was resized, it returned to the default size when switching between tables to beedited. (Bug #56314)

• In the EER Diagram view, a copied object could not be pasted, if the object had previously been pastedand then edited. (Bug #55336)

Page 368: MySQL Workbench

Changes in Release 5.2

360

• The commands to arrange objects were not enabled in the EER Diagram view. This rendered itimpossible to move objects to the back or bring them to the front. (Bug #57907)

• In the SQL Editor, right-clicking a table name and selecting Alter table did not launch the Alter tabledialog as expected. This happened if the table name utilized mixed case letters. (Bug #58223)

• In the SQL Editor tab of the Workbench Preferences dialog, if the OK button was not clicked centrally,it was possible to accidentally select or deselect one of the options Treat BINARY/VARBINARY asnonbinary character string or Enable Data Changes Commit Wizard. (Bug #57669)

• In the SQL Editor, in the Foreign Key tab of the new-table dialog, it was not possible to select any ofthe foreign key check boxes. (Bug #56024)

• The SQL Editor generated these errors if a query ran longer than 30 seconds:

Error Code: 2013 Lost connection to MySQL server during queryError Code: 2006 MySQL server has gone away

(Bug #57449)

• Find and Find and replace did not work in the SQL Query tab. (Bug #56898)

• MySQL Workbench crashed when a snippet in the snippet list was right-clicked. (Bug #56588)

• Selecting a Refresh or Refresh all button or menu item caused the list of tables and views in thesidebar to become empty. (Bug #55214)

• In the Columns tab of the Table Editor, double-clicking to edit or add a new column caused the windowto scroll to the top. (Bug #57793)

• When saving over a read-only file, MySQL Workbench changed the file permissions to read/write. (Bug#56403)

• If the relationship editor was already open, it was not possible to open it for another relationship withoutclosing it first. (Bug #55708)

• The forward engineering process generated SQL code that quoted boolean values, causing incorrectcast values. When a table contained the logical BOOLEAN type for a field it was converted toTINYINT(1) as expected. However, the values that were supplied for any inserts were quoted, as inthis example:

INSERT INTO mytable (id,flag) VALUES (NULL,'TRUE');

(Bug #57545)

• In the Administrator, most columns were not sortable. For example, in the Connections tab, it was notpossible to sort connections based on clicking the columns id, User, Host, DB, Command, Time, State,Info. (Bug #55813)

• The PYTHONPATH environment variable from other Python installations interfered with MySQLWorkbench. At startup, the error “cannot open SSH Tunnel Manager” appeared. Further, it was notpossible to use the MySQL Workbench administrative functions. (Bug #55674)

• On the Select Object page of the Reverse Engineer Database dialog, the panels displayed whenShow Filter was clicked did not resize correctly when Hide Filter was clicked. (Bug #57376)

• When an EER diagram that was in the background was closed, it was not possible to reopen it. (Bug#55767)

Page 369: MySQL Workbench

Changes in Release 5.2

361

• Creating a many-to-many relationship between two tables resulted in only one index being generated.(Bug #56613)

• In the Reverse Engineer SQL Script wizard, on the Input and Options page, the button to select theSQL script file had the text “Brow” instead of “Browse”. (Bug #57929)

• It was not possible to add a comment for a Layer using the Object Editor. MySQL Workbench has beenupdated so that it is possible to add a comment for a layer using the Object Editor. (Bug #50668)

• MySQL Workbench permitted an AUTO_INCREMENT column to be assigned a default value in the TableEditor, resulting in invalid DDL being generated. (Bug #49279)

• Formatting of view code entered in the View Editor was not retained after synchronization of the modelwith the server. (Bug #52004)

• In the Administrator, system health displayed NO DATA. (Bug #52151)

• When using the Administrator, the CPU utilization jumped to 50%. (Bug #50578)

• After printing, the status message displayed included incorrect capitalization. “Print Diagram done”should have been displayed as “Print diagram done”. (Bug #50035)

• The menu option View, Windows, menu item did not appear to have any useful function. (Bug #49056)

• The schema editor decreased in size by several pixels each time a new schema was edited. (Bug#49425)

• The SQL Editor did not display the execution times for queries. (Bug #49390)

Changes in MySQL Workbench 5.2.30 (20 November 2010)

This section documents all changes and bug fixes applied since the release of 5.2.29.

Functionality Added or Changed

• An advanced search and replace dialog has been added to MySQL Workbench. This can be accessedfrom the main menu Edit option, Find and replace or the keyboard shortcut Control+Shift+f. (Bug#56629)

• MySQL Workbench has been changed so that the Query Editor in the SQL editor includes an SQLformatter. Code can be highlighted and formatted using the Edit, Format menu item. (Bug #50822)

Bugs Fixed

• In the Table Editor of the SQL Editor, on the Foreign Keys tab, selecting the Referenced Tabledropdown for a database containing a large number of tables caused MySQL Workbench to becomeunresponsive while the dropdown was being populated. (Bug #56014)

• The output generated as a result of using the Print and Print Preview menu items was incorrect. Only themagnified top left corner of the EER diagram was displayed. (Bug #55139)

• After a query was executed, MySQL Workbench crashed when the Export button was clicked to exportthe result set to a file. (Bug #57379)

• For attempts to connect to a server using SSH, MySQL Workbench produced this error message afterthe user entered the password:

AttributeError: ServerProfile instance has no attribute 'serverInfo'

Page 370: MySQL Workbench

Changes in Release 5.2

362

(Bug #57695)

• On Linux Fedora 14, MySQL Workbench produced this error at startup:

/usr/bin/mysql-workbench-bin: error while loading shared libraries: libpython2.6.so.1.0:cannot open shared object file: No such file or directory

(Bug #56863)

• The implementation of get_local_ip_list() had several problems:

• It did not have a graceful fallback state in the event of errors.

• It failed if ifconfig was not on the default user path.

• It did not handle IPv6 addresses.

(Bug #57537)

• In the SQL Editor, it was not possible to close the last remaining tab. Closing the last remaining tabshould result in a new blank tab being displayed. (Bug #57137)

• When importing an SQL script using the Reverse Engineer SQL Script wizard, copying a path from theclipboard to the Select SQL script file input box resulted in an “invalid path” error. (Bug #57927)

• The default settings for the Export Directory Path in the Workbench Preferences dialog used mixedfile path delimiters (both '/' and '\'). (Bug #57944)

• In the Create Table dialog of the SQL Editor, if a new column was created with a synonym data typesuch as INTEGER, the datatype would appear blank, both in the interface and in the generated SQL.This resulted in an error when clicking the Apply SQL button. (Bug #55620)

• In the Alter Table dialog of the SQL Editor, attempts to reorder columns failed. If a column position waschanged, and then the Apply button was clicked, the dialog reported that no changes to the object weredetected. (Bug #54923)

• When a model was forward engineered with File, Export, Forward Engineer SQL CREATE Script, thegenerated script contained a statement that consisted of a single delimiter, ';'. (Bug #57378)

• When a foreign key was created manually, if the referenced table did not exist, MySQL Workbenchcrashed. (Bug #57470)

• In the EER diagram view, the table titles were the same color as the background color, making the tabletitles illegible. (Bug #57428)

• It was not possible to change the name of an EER Diagram. The facility was missing from the DiagramProperties and Size dialog. (Bug #56625)

• Foreign keys were not updated when a referenced column was deleted. (Bug #55219)

• If the SSL option was selected for a standard TCP/IP connection, there was no facility provided to enterthe SSL certificate details. (Bug #57101)

• The safe updates option on the SQL Editor tab of the Preferences dialog required a MySQLWorkbench restart to take effect. (Bug #56159)

• When a new instance was created to connect using SSH with an SSH certificate file, the location of thecertificate file was not saved. (Bug #52048)

Page 371: MySQL Workbench

Changes in Release 5.2

363

• In SQL Editor, when using the Alter Table facility to set a column to Auto Increment (AI), the dialogreported that “No changes to object were detected”. (Bug #50214)

Changes in MySQL Workbench 5.2.29 (12 October 2010)

This section documents all changes and bug fixes applied since the release of 5.2.28.

Functionality Added or Changed

• An open model that has not been saved is now automatically saved after a user-settable period. Onloading a model file, MySQL Workbench will notify the user if the file was not previously saved correctly,due to a crash or power failure. MySQL Workbench can then attempt to recover the last auto-savedversion. Note that for automatic recovery to be available for a new file, it will have to have been saved bythe user at least once. (Bug #56718)

• The Autosave feature was added. (Bug #50044, Bug #11757926)

Bugs Fixed

• Security Fix: Bug #57080 was fixed.

• Scripts could successfully be executed on the MySQL Server failed to execute in the MySQL WorkbenchSQL Editor. (Bug #56833)

• In the Model View, MySQL Workbench crashed when the Output tab was reopened after previouslybeing closed. (Bug #57150)

• Screen areas in the Administrator did not redraw correctly. It was necessary to move the main window toforce a redraw. (Bug #55490)

• If an EER diagram was created and then closed, attempting to reopen it caused MySQL Workbench todisplay an unexpected error dialog. (Bug #57259)

• In the Administrator, clicking the Data Dump tab generated the error Error updating DB: floatdivision and schemata were not displayed. (Bug #56658)

• In the SQL Editor, if some table data was edited, and then the connection to the server was lost, clickingthe Apply changes to data toolbar button caused MySQL Workbench to crash.

Now MySQL Workbench shows an error message in the Output tab when a connection is lost. Oncethe connection is back up, clicking Apply changes to data re-establishes the connection and sends thechanges to the server. (Bug #56170)

• If a foreign key was set to RESTRICT for On Delete and On Update on the Foreign Keys tab of theTable Editor, MySQL Workbench generated SQL code to drop and add this key on every subsequentsynchronization attempt. (Bug #55155)

• Clicking the Inserts tab of the Table Editor resulted in the MySQL Workbench Unexpected Errordialog being displayed. (Bug #57346)

• Changes made to a server instance were not saved. In particular, changing installation type to “Custom”was not saved, and changes to the sudo command were also not saved. (Bug #57026)

• It was only possible to connect to a MySQL server for administration using an SSH connection. (Bug#56874)

• Attempting to open the Table Editor in the SQL Editor multiple times for a table that contained no primarykey caused MySQL Workbench to crash. (Bug #57139)

Page 372: MySQL Workbench

Changes in Release 5.2

364

• In the Alter Table dialog of the SQL Editor, attempting to create a new index in the Index tab wasnot actioned when the Apply button was clicked. The dialog reported that “no changes to object weredetected”. (Bug #56906)

• When synchronizing a model to a live database, if a database was deselected in the wizard, aDROP statement for that database was generated in the SQL code to prevent it from being part ofthe synchronization process. This caused that database to be dropped from the live database, withcorresponding loss of all data. (Bug #56938)

• When attempting to open an EER Diagram by double-clicking it in the Model Overview, MySQLWorkbench generated this unexpected error:

Cannot access a disposed object.Object Name: ModelDiagramForm.

(Bug #56963)

• Folding of iteration statement blocks, such as WHILE, REPEAT, and LOOP, did not work correctly in theSQL Editor. The loop end constructs such as END WHILE, END REPEAT, and END LOOP were notrecognized as expected. (Bug #55358)

• If a table containing a User Defined Type based on VARCHAR was forward engineered, the resultingSQL did not correctly quote the VARCHAR value, resulting in a server error. For example, this code wasgenerated:

CREATE TABLE IF NOT EXISTS `x`.`tabley` (`customstring` VARCHAR(10));INSERT INTO `x`.`tabley` (`id_customstring`) VALUES (example);

The correct INSERT statement should be:

INSERT INTO `x`.`tabley` (`id_customstring`) VALUES ('example');

(Bug #56710)

Changes in MySQL Workbench 5.2.28 (19 September 2010)

This section documents all changes and bug fixes applied since the release of 5.2.27.

Functionality Added or Changed

• Added the ability to copy column names from result sets to the clipboard. (Bug #53000, Bug #11760578)

• The following command line options have been added to MySQL Workbench:

• --admin instance: Launch MySQL Workbench and load the specified server instance

• --query connection: Launch MySQL Workbench and load the specified connection

• --model modelfile: Launch MySQL Workbench and load the specified model

• --script script: Launch MySQL Workbench and run the specified script

• --run code: Launch MySQL Workbench and run the specified code snippet

• --quit-when-done: Quit MySQL Workbench after --script or --run finishes

(Bug #46340)

• The SQL Editor now displays the number of rows matched after a query. (Bug #48772)

Page 373: MySQL Workbench

Changes in Release 5.2

365

Bugs Fixed

• Running a TRUNCATE statement in the SQL editor with safe updates enabled resulted in this error:

Error Code: 1175You are using safe update mode and you tried to update a table without a WHERE that usesa KEY column

(Bug #56597)

• In the SQL Editor, a crash occurred if User Snippets was selected after another snippet collection hadbeen selected, and then the Replace active SQL Editor contents with selected snippet button wasclicked. (Bug #56626)

• In the SQL Editor, a statement containing CREATE DATABASE resulted in an unexpected error. (Bug#56295)

• The Table tab of the Table Editor contained a typo in the description for the Name field. Replaced wasspelled as “raplaced”. (Bug #56518)

• The mydb database was created by default when reverse engineering from an existing database orscript. (Bug #56183)

• When OpenGL rendering was selected, the EER Diagram area was not redrawn due to faulty OpenGLdrivers. The workaround was to launch MySQL Workbench using the -swrendering command lineoption. Now MySQL Workbench includes an option to select software rendering in the WorkbenchPreferences dialog. (Bug #55863)

• In the Accounts tab of the Administrator, an Unexpected Error occurred if a foreign character wasused in the Login Name field of the Server Access Management tab. The same bug also affected theSchema Privileges tab. (Bug #56534)

• In the View Editor, if the name of a view was changed in the code editor to the name of a pre-existingview of that name, the contents of the pre-existing view were replaced by the contents of the new view,even though the new view was created with a different name. (Bug #55661)

• Importing an exported file from a network share resulted in this error due to incorrect escaping of thepath:

08:44:00 Restoring \\server\d$\file.sql

Running: mysql.exe --defaults-extra-file="c:\...\tmp3oc8ig" --host=localhost--user=root --port=3306 --default-character-set=utf8 --comments <"\\\\server\\d\$\\file.sql"

The specified path is invalid.

(Bug #56735)

• In MySQL Workbench list controls, when an item was selected and another item right-clicked, thecontext-sensitive menu displayed options related to the first list item selected, rather than the current listitem being right-clicked, and any action selected was carried out on the first item. (Bug #56077)

• A plugin that used Mforms generated this error at MySQL Workbench startup:

..... line 16, in <module>import mformsImportError: No module named mforms

(Bug #55243)

Page 374: MySQL Workbench

Changes in Release 5.2

366

• It was no longer possible to rename a schema by double-clicking the schema tab in the PhysicalSchemata section of the Model View. (Bug #55010)

• If an SQL script containing international characters was saved in the SQL Editor and then restored, thelast character in the restored file was missing. (Bug #56083)

• If a view was created with correct syntax for an existing schema, and then Model menu, Validate (SQL)was selected, and either Validate All or Check Syntax was selected, this error message was generatedin the Output window:

Syntax error in view 'view_name'. View code is 'CREATE VIEW ...'

(Bug #54969)

• Attempts to define a foreign key for a table with a composite primary key caused MySQL Workbench tocrash. This happened while trying to select the fields of the composite primary key to be associated withthe referenced columns. (Bug #56496)

• If a foreign key was about to be renamed, and the corresponding text field had focus, MySQLWorkbench crashed if the model was then closed. (Bug #56315)

• If a model contained two schemata, and an attempt was made to forward engineer only one of theschemata by use of the object filters, data loss could result. This happened because a DROP statementwas generated for both schemata in the model, rather than just the one being forward engineered. (Bug#55918)

• MySQL Workbench exhibited a variety of crashes if, in the Model View, EER diagrams were repeatedlycreated and deleted. MySQL Workbench also crashed if all objects in the diagram were copied andpasted to the same diagram several times, and then the diagram was deleted. Unexpected errorsgenerated included:

• Object is currently in use elsewhere

• Index is outside the bounds of the array

• Index must be within the bounds of the List

(Bug #55304)

• If all objects were selected in the model view, and then the Edit Selected menu item was selected,MySQL Workbench generated an unexpected error. (Bug #54695)

• If the MySQL server configuration file was modified using the Administrator to deactivate InnoDB, theMySQL server failed to restart, and generated this error in the log:

[ERROR] C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld: Error whilesetting value 'FALSE' to 'innodb'

(Bug #55029)

• The Workbench Scripting Shell dialog could be increased in size, but not subsequently reduced in size.(Bug #56049)

• On Microsoft Windows, MySQL Workbench crashed if the Trebuchet MS font was missing or corrupted.Now MySQL Workbench falls back to a secondary font if the Trebuchet MS font is missing or corrupted.(Bug #54953)

• MySQL Workbench application failed to start on Mac OS X. (Bug #55412)

Page 375: MySQL Workbench

Changes in Release 5.2

367

• There were two problems in the new_table dialog of the SQL Editor:

• When Apply was clicked, in the Apply SQL Script to Database dialog, if Apply SQL was clicked,the SQL would be applied without error. However, if the Back button was clicked and the Apply SQLbutton clicked again, an error would be generated. If this process was repeated, each time a slightlydifferent error would be added to the list of errors displayed.

• The Cancel and Finish buttons appeared to have the same functionality, and simply returned the userto the new_table dialog.

(Bug #56000)

• Added MySQL Server 5.5 support. (Bug #51365, Bug #11759082)

• On Microsoft Windows, when saving a MySQL configuration file from within the Administrator, Windowsdisplayed the UAC dialog twice. MySQL Workbench has been changed so that Windows now onlydisplays the UAC dialog once. (Bug #49674)

Changes in MySQL Workbench 5.2.27 (01 September 2010)

This section documents all changes and bug fixes applied since the release of 5.2.26.

Functionality Added or Changed

• Several changes were made to the Synchronize Model With Database wizard:

• The wizard shows all schemata in a model, regardless of whether they exist in the live database.

• The wizard shows a list of schemata that exist in the model but are missing from the live server, with anote recommending the use of the Forward Engineering wizard.

• The wizard does not auto-select schemata names that are in the model but not in the live database.

(Bug #54748)

Bugs Fixed

• When the Alter Table dialog for an InnoDB table was displayed in an SQL Editor session, the ForeignKey Options Index showed INVALID when a foreign key in the Foreign Keys tab was clicked. (Bug#54471)

• When an attempt was made to synchronize a model with a live database, no schemata were listedas available in the Synchronize Model with Database wizard. This happened when the name of theschema in the model and the schema on the live server differed only in lettercase. (Bug #55147)

• At startup, these warnings were generated in the Workbench Scripting Shell:

Starting Workbench...Registered 147 GRT classes.WARNING: Could not load wb.mysql.validation.grt.dylib: Invalid module/Applications/MySQLWorkbench.app/Contents/PlugIns/wb.mysql.validation.grt.dylib

WARNING: Could not load wb.validation.grt.dylib: Invalid module/Applications/MySQLWorkbench.app/Contents/PlugIns/wb.validation.grt.dylib

(Bug #54929)

• When an attempt was made to synchronize a modified exported script with the current model, using File,Export, Synchronize with SQL Create Script, the model was not updated. (Bug #54501)

Page 376: MySQL Workbench

Changes in Release 5.2

368

• After dropping a schema from the list in the Object Browser, the schema that was dropped remained,but with the name of the schema that followed it. Refreshing the list of available schemata produced anunhandled exception:

An unhandled exception has occurred:Invalid node index

(Bug #55861)

• MySQL Workbench crashed when using the Export recordset to an external file command button onthe result pane of the SQL Editor. (Bug #55554)

• When using the Edit Table Data wizard (launched from Home screen), if a database with a single tablewas connected to, after selecting the table, the Finish button remained grayed out. (Bug #54942)

• In the SQL Editor, right-clicking a routine name in the Object Browser caused MySQL Workbench to exitunexpectedly. (Bug #55822)

• If a table was copied in the EER Diagram view, and then the model was synchronized with the livedatabase, the synchronize functionality did not recognize the copied table as a new table and overwrotethe original table. (Bug #55566)

• Renaming a column with a foreign key resulted in an invalid script being generated on forwardengineering or synchronization with a live database. (Bug #55502)

• The second attempt to save a read-only model file produced this error:

Couldn't backup existing file name-of-the-file.mwb: No such file or directory

(Bug #55439)

• When a table was being edited in the Table Editor, and its name was changed, the name change wasnot reflected on the Table Editor's table tab. (Bug #55338)

• It was not possible to add the LOCK TABLES privilege when assigning a new role in the Model Overviewbecause that privilege was missing from the available options. (Bug #55186)

• Selecting the Check Duplicated Identifiers (Additions) operation from the Validation (SQL) submenu ofthe Model menu produced this error message:

Type mismatch: expected object of type db.Schema, but got workbench.physical.Model

(Bug #54968)

• The schema collation was not saved after being changed in the Table Editor. (Bug #55152)

• Selecting Validate (SQL) from the Model menu and then selecting the Validate All option reportedno errors. Selecting Forward Engineer from the Database menu and selecting Run Validations alsoreported no errors. However, executing the SQL script resulted in this error:

ERROR: Error 1005: Can't create table 'xxx' (errno:150)

(Bug #54985)

• MySQL Workbench crashed when using the Partitioning tab of the Table Editor. (Bug #55761)

• Forward engineering a model to a live database caused MySQL Workbench to crash. (Bug #56009)

• MySQL Workbench crashed in the foreign key editor. The Microsoft Visual C++ Runtime Library runtimeerror generated prior to the crash was:

Page 377: MySQL Workbench

Changes in Release 5.2

369

R6025

- pure virtual function call

(Bug #55910)

• The Dump tab did not display the target folder before the dump was performed. (Bug #55945)

• Dumping tables or schemata without the LOCK TABLE privilege produced this error:

mysqldump: Got error: 1044: Access denied for user 'wwroot'@'%' to database db' whendoing LOCK TABLES

(Bug #55019)

• Selecting "Dump views" for a backup produced this error:

Unhandled exception: global name 'views_by_schema' is not defined

It was necessary to restart the Administrator to enable the dump facility again. (Bug #55833)

• If the sidebar was placed on the right hand side, using the option in Workbench Preferences, thisUnexpected Error was generated when Add Diagram was double-clicked:

SplitterDistance value is invalid (-52)

(Bug #55902)

• Attempts to restore a backup of selected tables resulted in this error:

File "C:\Program Files\MySQL\MySQL Workbench 5.2 CE\modules\wb_admin_export.py", line841, in start

logmsg = "Restoring %s (%s)" % (schema, table)

NameError: global name 'schema' is not defined

(Bug #56020)

• When using MySQL Workbench to report a bug, it was not possible to attach a file using the Choose Filebutton because the button had no effect. (Bug #55112)

• In the SQL Editor, executing statements designed for MySQL Server 5.5 generated syntax or syntaxhighlighting errors. (Bug #55867, Bug #55891)

• MySQL Workbench caused Windows XP to reboot if launched from Start, Programs, MySQL, MySQLWorkBench 5.2 OSS.

If a MySQL Workbench model file (.mwb) was opened directly, an error dialog titled Microsoft Visual C++ Runtime Library was displayed with the message:

R6034An application has made an attempt to load the C runtime library incorrectly. Pleasecontact the application's support team for more information.

The dialog's only option was OK. After clicking OK, two more instances of the same dialog weredisplayed. After clicking OK for all three, MySQL Workbench opened with the model file displayed.

On Windows 7 x64, the same runtime error (R6034) occurred. (Bug #52949)

• Opening an SQL Editor connection for a remote server produced this error:

Page 378: MySQL Workbench

Changes in Release 5.2

370

OverviewBE::get_node:invalid node 0.0.0.

(Bug #52648)

Changes in MySQL Workbench 5.2.26 (06 August 2010)

This section documents all changes and bug fixes applied since the release of 5.2.25.

Functionality Added or Changed

• When using the MySQL Workbench table properties to add a foreign key, the size of a new foreign keyfield will now update to match the size of the corresponding primary key. (Bug #55083, Bug #11762482)

• Added the default value of CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP to context menuof column editor for TIMESTAMP columns. (Bug #54987)

• A validation module (a SE feature only) has been added. It sends an alert if foreign keys are beingused in or to a partitioned table. Note: partitioned tables do not support foreign keys. (Bug #44273, Bug#11752933)

Bugs Fixed

• When using su -user instead of sudo, rather than requesting the password of the user for invokingthe su command, MySQL Workbench requested the root password and attempted to invoke the sudocommand. (Bug #53740)

• In the Administrator, if the MySQL server configuration file was modified to enable skip-innodb, andthe server was restarted, InnoDB was still active. (Bug #55030)

• On the Snippets tab, the tooltip for the Insert selected snippet to cursor position in the active SQLeditor button contained the misspelling “selected”. (Bug #55026)

• In the Overview tab of the SQL Editor, if there was a large number of schemata, using the arrow buttonsin the interface to scroll through them caused MySQL Workbench to crash, usually on the last schema inthe list. (Bug #54891)

• MySQL Workbench crashed if minimized while loading a model. (Bug #54918)

• In the Synchronize Model with Database wizard, the list of schemata was not drawn correctly on theSelect Schemata page, if Back was clicked from the Fetch Object Info page. (Bug #55174)

• Importing a DBDesigner model caused MySQL Workbench to crash. (Bug #55300)

• When a model was synchronized with a live database, CHAR(N) columns were always synchronized asCHAR(1). (Bug #55334)

• Complex queries with multiple newlines did not fit well in the Action column of the Output tab of theSQL Editor. This prevented any query error messages from being read. (Bug #55117)

• When using the SQL Editor and issuing a query containing SQL_CALC_FOUND_ROWS and a subsequentFOUND_ROWS() query, FOUND_ROWS() returned zero instead of the number of matching rows without aLIMIT applied. (Bug #54868)

• Multi-statement syntax did not work in the SQL Editor. If the delimiter was set to a character other thanthe default semicolon, the SQL Editor should still have recognized semicolon as a valid delimiter formulti-statements, but it did not. (Bug #54831)

Page 379: MySQL Workbench

Changes in Release 5.2

371

• In the SQL Editor, if a column's comment contained a Chinese word, then in the Object Browser, if thecontext-sensitive menu item Send to SQL Editor, Create Statement was selected, incomplete script codewas sent to the SQL Query tab. (Bug #54822)

• In an EER Diagram, the circles at each end of a relationship line were drawn in different sizes. (Bug#54663)

• In forward engineering a model to a database, the PRIMARY index was not reordered correctly whencolumns were reordered. (Bug #54176)

• When a model was forward engineered to a database, insert statements associated with binary datawere not present in the generated code. As a result, binary data was not forwarded to the database.(Bug #54680)

• In the Reverse Engineer Database wizard, using a pattern mask to filter tables being imported causeda subsequent MySQL Workbench crash. (Bug #55076)

• The Configuration section of the MySQL Workbench Administrator did not copy configuration variablesfrom the my.cnf file that contained an underscore character. (Bug #54933)

• MySQL Workbench would not compile on RHEL 5. This was due to the calls to the functionset_opacity in library/form/gtk/src/lf_utilities.cpp (line 661) and library/forms/gtk/src/lf_popup.cpp (line 64). The set_opacity function was not available in GTK 2.10. (Bug#54844)

• When forward engineering an SQL ALTER script, the generated code attempted to recreate all foreignkeys. (Bug #54363)

• On the Home screen, the saved connections previously listed in the Workspace were no longer visible.(Bug #55484)

• If the Start Server button was clicked twice in MySQL Workbench, the server would stop. (Bug #49588)

• When connecting to a server, MySQL Workbench prompted for a password, even if one had not beenset for that account. (Bug #52826)

• MySQL Workbench crashed when executing LOAD DATA LOCAL INFILE as a query in the SQL Editor.(Bug #49694)

• After creating a server instance and double-clicking it on the Home screen, the Administrator took anexcessively long time to load (over 10 minutes). (Bug #52530)

• When zooming in and out of the EER Diagram view, MySQL Workbench generated an unknown error.(Bug #52829, Bug #55390)

• In the list view of the physical schemata, clicking a list column heading failed to sort the items by thatcolumn. (Bug #38863)

Changes in MySQL Workbench 5.2.25 (30 June 2010, General Availability)

First GA 5.2 release. This section documents all changes and bug fixes applied since the release of 5.2.24.

Functionality Added or Changed

• MySQL Workbench now prompts the user for a password for attempts to connect using a “TCP overSSH” connection type, if a password was not previously provided during configuration of the connection.(Bug #47892)

Page 380: MySQL Workbench

Changes in Release 5.2

372

Bugs Fixed

• MySQL Workbench generated excessive diagnostic messages at startup. Now MySQL Workbench doesnot display diagnostic messages by default on Linux, unless activated by starting MySQL Workbenchwith the --verbose option. (Bug #54021)

• Compiling MySQL Workbench from source failed with this error while building library/grt/src/grtpp_grt.cpp:

Could not find file cairo_features.h (included from cairo.h, which is included fromlibrary/base/src/string_utilities.h, which is included in grtpp_grt.cpp)

(Bug #54833)

• When a .dbquery file created with MySQL Query Browser was opened in the SQL Editor, the ByteOrder Mark (BOM) was not removed. This led to an erroneous character being prepended to the firststatement, making it illegal. (Bug #54322)

• If the Alter Routine dialog was maximized in the SQL Editor, the dialog buttons were no longer visible.(Bug #53734)

• On exit, MySQL Workbench prompted the user to save changes for every query tab that had beenopened in the SQL Editor, even where a table had simply been viewed, and no script code had beenwritten by the user. (Bug #54754)

• In the Columns tab of the Table Editor, column ordering handling had numerous problems. Forexample, dragging and dropping a column did not locate the column as expected. (Bug #53749)

• When synchronizing a model with the live database, the generated SQL included erroneous DROPCOLUMN and ADD COLUMN operations, and also erroneous ADD INDEX and DROP INDEX operations.(Bug #54740)

• Inserts data did not appear to be preserved between MySQL Workbench versions.

A model was created with MySQL Workbench 5.1.18 and data inserted using the Insert tab. If the modelwas then saved and loaded into MySQL Workbench 5.2.22, and the model forward engineered to anSQL script, the generated script contained INSERT statements that inserted NULL instead of the dataoriginally entered. (Bug #54639)

• In the Data Dump section of the Administrator, using the Export to Backup Project Folder optionresulted in triggers being exported to both the table files and the routines files. Attempting to import theexported files produced an error due to the duplicated triggers. (Bug #54426)

• In the Configuration tab of the Administrator, the parameter innodb_support_xa on the InnoDBParameters tab has a corresponding check box. If this was selected and changes applied, theconfirmation dialog indicated these changes were made:

Added: [mysqld] innodb_support_xa = True

However, what was added to the my.cnf file was “innodb_support_xa”. This meant there was no way toset this parameter (which defaults to True) to False using MySQL Workbench. (Bug #53449)

• When forward engineering to a live database, the generated SQL statements contained an erroneousadditional carriage return at the end of each line. This manifested in two ways. In the first case, inthe Forward Engineer to Database wizard, if Save to File was selected, a carriage-return characterwas appended to each line. In the second case, if Copy to Clipboard was selected, and the contentsubsequently pasted from the clipboard to an editor, the extra carriage return characters was attachedonly to the DDL statements inside Create View and Create Trigger. (Bug #54272, Bug #54244)

Page 381: MySQL Workbench

Changes in Release 5.2

373

• In the Create Routine dialog of the SQL Editor, the text label associated with the Name textboxmentioned “view”, rather than “routine”. (Bug #54566)

• Minimizing MySQL Workbench after a connection with a server was established produced this error:

SplitterDistance must be between Panel1MinSize and (Width - Panel2MinSize)

(Bug #54482)

• Printing or previewing an EER Diagram in Landscape/Tabloid produced blank output. (Bug #54240, Bug#54601)

• MySQL Workbench displayed instability after an SSH connection to the server was closed, resulting inhanging or crashing behavior. (Bug #50554)

• In the Inserts editor, the underscores in column headings were incorrectly displayed as accelerator/shortcut keys. (Bug #48831)

• For the Manage DB Connections dialog, labels such as user name and password were hidden whenthe dialog was opened at its default size. (Bug #47890)

• In the Modeler, when opening a new object such as a table, the currently open tab was reused, ratherthan a new tab being opened. This made it difficult to compare objects such as tables and routines. (Bug#45557)

• In the SQL Editor, if a query was executed and MySQL Workbench was minimized, the Results tabwindow area was not correctly redrawn on maximizing the application. (Bug #51991)

• When synchronizing a model that contained triggers, MySQL Workbench generated erroneous DROPTRIGGER and CREATE TRIGGER statements, even when the triggers had not been changed. (Bug#51929)

• When creating a table containing columns with a BOOLEAN data type, the model then failed to validate,even though BOOLEAN is offered on the list of types available for columns. (Bug #49538)

• When a table was copied in the EER Diagram view, it was found that the paste menu option was visiblebut disabled when an attempt was made to paste the table into a new diagram. (Bug #38432)

Changes in MySQL Workbench 5.2.24 (21 June 2010)

This section documents all changes and bug fixes applied since the release of 5.2.23.

Functionality Added or Changed

• A Kill Query button has been added to the Connections tab of the Administrator. (Bug #54409)

Bugs Fixed

• The Connections tab in the Administrator did not feature automatic refresh. This had to be manuallytriggered using the Refresh button. Further, the Kill Connection button was sometimes incorrectlydisabled. (Bug #53703)

• In the Configuration tab of the Administrator, this error resulted when changes were applied:

Could not Save Configuration File

There was an error saving the configurationfile: exec_cmd() takes at least 3 arguments (2given)

Page 382: MySQL Workbench

Changes in Release 5.2

374

This happened while connecting to a FreeBSD 7.1 server over an SSH connection. (Bug #54647)

• In the SQL Editor, entering a space into the SQL Query tab, selecting an external tab (such as theOverview tab or Output tab), and then selecting File, Close Tab caused MySQL Workbench to crash.

Further, the Add Table dialog had numerous issues, including inability to select PK and other checkboxes, failure to validate input, inability to apply changes, and deletion of user data in certain cases.(Bug #54124)

• If a foreign key relationship was created, and its modelOnly property set, the relationship was correctlyexcluded when the model was synchronized with a live database. However, the DDL code for the foreignkey indexes was still generated in the synchronization script. (Bug #53420)

• In the SQL Editor, there was a space between the Execute and Stop toolbar buttons. Hovering themouse cursor over this space resulted in the tooltip “Explain selected SQL” being displayed, whichappeared to indicate a missing icon. (Bug #49316)

• Synchronizing a model with a live database generated ALTER statements, even when there appeared tobe no difference between the database and the model. (Bug #50938)

Changes in MySQL Workbench 5.2.23 (Internal release only)

This section documents all changes and bug fixes applied since the release of 5.2.22.

Functionality Added or Changed

• In the SQL Editor, when more result tabs were generated than could fit into the current panel, it wasnot obvious how to navigate to those result sets that could not currently be displayed. This could beachieved using the left and right arrow keys, but MySQL Workbench now also includes a spin control tonavigate the available tabs. (Bug #52998)

• The Overview tab in the SQL Editor now supports scrolling of content using the mouse wheel. (Bug#50782)

Bugs Fixed

• Changing the name of a stored procedure in the modeler and saving changes caused an erroneous ';'character to be added to the SQL code sent to the database. That resulted in this error:

ERROR 1064: You have an error in your SQL syntax; check the manual that corresponds toyour MySQL server version for the right syntax to use near ';

USE `911datashop`' at line 1SQL Statement:;USE `911datashop`

(Bug #54258, Bug #11761738)

• In the SQL Editor, for result set exports to a tab-delimited file, MySQL Workbench added a .CSV filename extension. (Bug #54302)

• In the SQL Editor, exporting a record set failed if the target path contained an international character.(Bug #54479)

• In the SQL Editor, if a table in the Overview tab was double-clicked, the query generated replaced codealready entered into the SQL Query tab, resulting in the loss of that code. (Bug #54362)

Page 383: MySQL Workbench

Changes in Release 5.2

375

• In the SQL Query tab of SQL Editor, tooltip error messages were still displayed, even after switching toanother tab. (Bug #53634)

• In the SQL Editor, attempting to execute a selection in the SQL Query tab caused all text to be executed,not just the selected text. (Bug #54536)

• MySQL Workbench crashed if a pinned result tab was refreshed in the SQL Editor. (Bug #54114)

• After a foreign key was created, and the referenced table or column was changed, the change was notreflected in the foreign key, resulting in errors. (Bug #54134)

• In the Inserts tab of the Table Editor, adding a new row and applying changes had no effect. (Bug#54456)

• The Document Properties dialog was displayed across two screens in a multiple-screen setup. (Bug#53262)

• Clicking external links in the embedded browser launched Internet Explorer rather than the defaultbrowser. (Bug #54192)

• Select All (Control+A) did not work when editing comments for a table or column. (Bug #54154)

• In the General tab of Configuration in the Administrator, when the Temp directory option wasselected, and a directory was selected using the file browser, MySQL Workbench inserted backslashesrather than forward slashes. If backslashes were used in this location in the configuration file, the servercrashed at startup. (Bug #54445)

• Synchronizing a model with a live database produced incorrect SQL code:

ALTER TABLE `mydb`.`table1` AUTO_INCREMENT = ;

(Bug #54319)

• Keyboard shortcuts such as Command+C, Command+V, and Command+Z were not useableconsistently in all parts of MySQL Workbench. (Bug #53790)

• Clicking a table caused MySQL Workbench to produce this error message:

MySQL Workbench has encountered a problemCannot access a disposed objectObject name: 'DockedWindowPlugin'.

(Bug #54498)

• When entering binary data into the Inserts tab for a table, the data was truncated at the first null byte(\0). (Bug #54156)

• Clicking the Edit Table Data action item from the Home screen caused MySQL Workbench to crash.(Bug #54230)

• Columns defined as BIT appeared as requiring synchronization, even if no changes had been made.(Bug #53747)

• In the SQL Editor, selecting Alter Table from the context-sensitive menu had no effect. (Bug #54283)

• In the SQL Editor, editing a table with a row highlighted, right-clicking a BLOB column and loading avalue from a file resulted in this error:

An external component has triggered an exception

(Bug #54266)

Page 384: MySQL Workbench

Changes in Release 5.2

376

• In the Alter Routine dialog of the SQL Editor, if the Find and Replace dialog was invoked with Control+F, and Control+V was used to paste in some search text, the text was actually pasted into the routinecode area. (Bug #53735)

• In the Layer Tree panel, if a layer was given a blank name, MySQL Workbench subsequently crashed,rather than warning about the of a blank name. (Bug #53807)

• The forward engineering Omit Schema Qualifier in Object Names option was not correctly applied tosome statements in Trigger code. In these cases, the schema name remained in place. (Bug #54222)

• An EER Diagram appeared to contain hidden tables. Although the diagram contained 12 tables, whena 'select all' was performed the user was informed that 14 tables were selected. It seemed that certaintables had been resized to be so small as to no longer be visible in the diagram. (Bug #53885)

• MySQL Workbench failed to build from source on Debian Linux. This error was generated:

libtool: compile: g++ -DHAVE_CONFIG_H -I. -I./src -I./src -pthread -DNDEBUG -Wall-Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -g -O2 -Wextra -Wall -Wno-unused-Wno-deprecated -c src/template.cc -fPIC -DPIC -o .libs/libctemplate_wb_la-template.oIn file included from ./src/ctemplate/per_expand_data.h:48, from ./src/ctemplate/template_modifiers.h:69, from src/template_modifiers_internal.h:53, from src/template.cc:61:./src/ctemplate/template_string.h:88: error: ISO C++ forbids declaration of 'TemplateId'with no type./src/ctemplate/template_string.h: In member function 'size_tctemplate::TemplateIdHasher::operator()(ctemplate::TemplateId) const':./src/ctemplate/template_string.h:234: warning: right shift count >= width of type./src/ctemplate/template_string.h: At global scope:./src/ctemplate/template_string.h:344: warning: overflow in implicit constant conversionsrc/template.cc: In static member function 'static voidctemplate::Template::AssureGlobalsInitialized()':src/template.cc:2365: warning: comparison between signed and unsigned integerexpressionsmake[5]: *** [libctemplate_wb_la-template.lo] Error 1

(Bug #53668)

• In the Alter Table dialog of the SQL Editor, if an attempt was made to set the NN flag for a column thatdid not have it set, an error was generated when the changes are applied. (Bug #53918)

• When carrying out an Alter Routine operation in the SQL Editor, if a routine was modified, and astatement used that, although syntactically correct, was not permitted in a routine, all modifications werelost when changes were applied. (Bug #53887)

• In the SQL Editor, attempting to create a new schema using Create Schema with a server collation ofutf8 - default collation produced SQL that resulted in an error when applied. (Bug #54097)

• Performing an undo operation in SQL Editor actually resulted in an undo operation in the Modeler. (Bug#54091)

• In the EER Diagram view, it was not possible to delete a relationship by right-clicking the relationship,then selecting Delete from the context-sensitive menu. (Bug #53659)

• In the Diagram Size dialog, displayed using Model, Diagram Properties and Size, it was possible to setthe size to 100 pages by 100 pages, but then click outside this area. This caused a MySQL WorkbenchUnexpected Error. (Bug #53559)

• Database export failed due to a faulty path in the command line:

15:42:52 Dumping rma3 (etat_produit)

Page 385: MySQL Workbench

Changes in Release 5.2

377

Running: "mysqldump.exe" --defaults-extra-file=c:\docume~1\user\localsettings\temp\tmp9ypdhd --no-create-info=FALSE --order-by-primary=FALSE --force=FALSE--no-data=FALSE --tz-utc=TRUE --flush-privileges=FALSE --compress=FALSE --replace=FALSE--host=127.0.0.1 --insert-ignore=FALSE --extended-insert=TRUE --user=root--quote-names=TRUE --hex-blob=FALSE --complete-insert=FALSE --add-locks=TRUE --port=3306--disable-keys=TRUE --delayed-insert=FALSE --delete-master-logs=FALSE --comments=TRUE--default-character-set=utf8 --flush-logs=FALSE --dump-date=TRUE --allow-keywords=FALSE--create-options=TRUE --events=FALSE "rma3" "etat_produit"

Could not open required defaults file: c:\docume~1\user\local

Fatal error in defaults handling. Program aborted

mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password:NO) when trying to connect

Operation failed with exitcode 2

(Bug #54067)

• The integrated docs web server listened on a fixed port (8811), and was not able to handle the situationwhere this port may be used by another service, such as another MySQL Workbench instance. (Bug#54104)

• MySQL Workbench suffered user interface issues when used on a KDE-based system using a darktheme. (Bug #54083)

• The HTTP server thread started by MySQL Workbench to provide documentation to the local webbrowser listened on all IP interfaces, even though it is intended only for local use. (Bug #54083)

• When synchronizing with a live database, MySQL Workbench did not interpret whitespace inENUMs correctly. For example, ENUM('image', 'video', 'swf') was seen as different fromENUM('image','video','swf'), causing the live server and model to appear unsynchronized. (Bug#49182)

• When editing a column in the table editor, pressing Control+Z to undo the edit resulted in a previousoperation being undone instead. (Bug #46286)

• After a default primary key name was set in the Workbench Preferences dialog, the PK flag was notselected as expected in the Table Editor and the column flags could not be selected. (Bug #52578)

Changes in MySQL Workbench 5.2.22 (02 June 2010)

This section documents all changes and bug fixes applied since the release of 5.2.21.

Functionality Added or Changed

• On Linux, MySQL Workbench automatically added a .sql extension, where an extension was notspecified, to any script file saved from the SQL Editor. MySQL Workbench now does not automaticallyadd a .sql extension on Linux. However, on Windows, the file extension is added if one is not specified.(Bug #53731)

• MySQL Workbench now supports creating a new tab in tabbed interfaces by using Control+T onWindows and Command+T on Mac OS X. (Bug #48798)

• The SQL Editor now includes a new Set as Default Schema context menu item. This is applicable toschema nodes in the Object Browser and the Overview panel of the Query Editor. Previously the onlyway to change the default schema was to select the schema from the schema selector list located at thetop of the Object Browser. (Bug #51479)

Page 386: MySQL Workbench

Changes in Release 5.2

378

• MySQL Workbench now indicates that changes need to be saved using only an asterisk in the ModelOverview tab, rather than this being reflected on individual EER Diagrams. (Bug #53042)

• MySQL Workbench now supports entering of expressions such as DEFAULT or CURRENT_TIMESTAMPinto the inserts editor. The expression needs to be preceded by \func. See Live Editing Tabsheets.(Bug #36206)

Bugs Fixed

• MySQL Workbench did not size its application window correctly on screen sizes with a 16/9 aspect ratio.(Bug #53984, Bug #11761483)

• The Gnome keyring package was a dependency of MySQL Workbench. It was undesirable to require itsinstallation on KDE-based systems. (Bug #54010)

• MySQL Workbench crashed on selection of the Model, Create Diagram from Catalog Objects menuitem. (Bug #53454)

• On the Model Overview page, when a new user object was created with Add User in the Schemaprivileges section, it was not possible to change any of the user object's attributes. For example, if thename of the object was changed, it would then change back to its original setting. (Bug #53946)

• If a property value was changed in the Workbench Preferences dialog, and OK was clicked, or a newtab was clicked before the cursor was moved away from the value being changed, the change wassilently reverted. (Bug #54060)

• In the SQL Editor, performing a query on a remote server returned BLOB values for columns that werenot of type BLOB.

Because binary byte strings tend to contain null bytes in their values, for safety reasons they were notdisplayed in the results grid. They could only be viewed or edited by means of the BLOB editor to avoiddata truncation.

MySQL Workbench now includes a new global option that has been added to the SQL Editor tab of theWorkbench Preferences dialog. The option is Treat BINARY/VARBINARY as non-binary characterstring. By default, it is not selected. (Bug #53920)

• In the SQL Editor, the toolbar items on the Snippets tab to replace and insert snippets had no effectwhen clicked. (Bug #53610)

• In the EER Diagram view, heavy flicker resulted if the cursor was hovered over relationship lines ortables. (Bug #53941)

• In the Data Dump section of the Administrator, this error occurred when an export was generated:

mysqldump: Error 2020: Got packet bigger than 'max_allowed_packet' bytes when dumpingtable 'xxx' at row: 1

This happened only for larger tables. (Bug #53599)

• If the Manage Server Instances dialog was launched, and either the New or Delete button was clicked,and then the dialog was closed, MySQL Workbench crashed if the New Server Instance action itemwas then clicked on the Home screen. (Bug #54028)

• When a table containing triggers was loaded into the Alter Table dialog of SQL Editor, clicking theTriggers tab showed an empty trigger, rather than the correct trigger code. (Bug #53940)

• In the SQL Editor, if code was entered into the SQL Query tab, and then the application exited, MySQLWorkbench did not prompt the user regarding unsaved changes, so they were lost. (Bug #53848)

Page 387: MySQL Workbench

Changes in Release 5.2

379

• In the Data Dump tab of the Administrator, the Options panel was not rendered correctly. (Bug #53681)

• Specifying a new font for the SQL Editor's SQL Query tab contents had no affect on appearance. (Bug#53605)

• With multiple tabs open in the SQL Editor, if the script in each tab was saved to a file in turn, the scriptwas actually saved over the previously saved script, resulting in the loss of that script. (Bug #53733)

• If multiple SQL Query tabs were opened in the SQL Editor, when a snippet was saved to the snippet list,the snippet saved would always be from the last opened SQL Query tab (the furthest to the right), ratherthan the currently selected tab. (Bug #53713)

• In the Create Schema dialog of the SQL Editor, when a new schema name was entered, and changesapplied, the schema name appeared to revert to the default name new_schema, rather than beingchanged to the newly specified name. This only happened on Mac OS X. (Bug #53764)

• In the SQL Editor, if two procedures were defined in a script, each proceded with a suitable DROPstatement, then when the script was executed and the procedures already existed, a “procedure alreadydefined” error occurred. It appeared that the second DROP statement was being ignored. This problemhappened if the line preceding the second DROP statement was terminated with a space. (Bug #53760)

• When a model containing a stored procedure was forward engineered to a script, the script containedinvalid SQL code. This happened when the DROP Objects Before Each CREATE Statement andExport MySQL Routine Objects options were selected. Problems with the SQL code included adelimiter being used before its definition and also DROP statements not being terminated. (Bug #53467)

• Attempting to copy objects from an existing diagram to a new diagram resulted in this error:

OverviewBE::get_node: invalid node 1.0.0.22

(Bug #53914)

• In the Create New Server Instance Profile wizard, on the Operating System page the MySQLInstallation Type list was not populated correctly. Although all items were initially correctly displayed,if the Back button was clicked, and then Next clicked to return to the page, all the items in the list wereduplicated. Each time this process was repeated the original list items would again be duplicated. (Bug#53649)

• In the SSH Shell Connection panel of the Manage Server Instances dialog, if any port other than 22was specified, it was subsequently ignored. (Bug #53623)

• When MySQL Workbench was launched, an overlay was displayed. In the application bar, the dialogprompting for the keyring password was waiting for input, but it was not possible to enter the passwordbecause the overlay hid the dialog. (Bug #53974)

• Compiling MySQL Workbench from source failed with these errors:

...-I../../library/dbc/src -I../../library/vsqlite++/include -D_FORTIFY_SOURCE=2 -O2-fno-strict-aliasing -fwrapv -march=x86-64 -gdwarf-2 -g2 -Wextra -Wall -Wno-unused-Wno-deprecated -ggdb3 -DENABLE_DEBUG -MT canvas_floater.o -MD -MP -MF.deps/canvas_floater.Tpo -c -o canvas_floater.o `test -f 'model/canvas_floater.cpp' ||echo './'`model/canvas_floater.cppmodel/canvas_floater.cpp: In constructor 'wb::Floater::Floater(mdc::Layer*, conststd::string&)':model/canvas_floater.cpp:65:59: error: cannot call constructor 'mdc::Color::Color'directlymodel/canvas_floater.cpp:65:59: error: for a function-style cast, remove the redundant'::Color'

Page 388: MySQL Workbench

Changes in Release 5.2

380

make[3]: *** [canvas_floater.o] Error 1make[3]: Leaving directory`/home/users/Arvenil/rpm/BUILD/mysql-workbench-oss-5.2.21/backend/wbprivate'make[2]: *** [all-recursive] Error 1make[2]: Leaving directory`/home/users/Arvenil/rpm/BUILD/mysql-workbench-oss-5.2.21/backend'make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/home/users/Arvenil/rpm/BUILD/mysql-workbench-oss-5.2.21'make: *** [all] Error 2

(Bug #53687)

• On the Home screen, the MySQL Team Blog and Workbench Team Blog icons linked to the same page.Further, the MySQL News Letter icon linked to the MySQL Developer forum. (Bug #53628)

• In the SQL Editor, when attempting to change an index from INDEX to UNIQUE using the Alter Tabledialog, no changes were applied, and this error message was generated:

No changes to object were detected

(Bug #53787)

• In the SQL Editor, the context-sensitive menu options Copy to Clipboard and Send to SQL Editor bothfailed to work. This applied to both copying in the Object Browser and in the Overview tab. (Bug#53903)

• In the SQL Editor, when renaming views or routines using the live editor, the generated ALTER scriptcontained only DROP statements and not CREATE statements. (Bug #53847)

• When forward engineering a schema to a database with the DROP Objects Before Each CREATEObject option selected, the DROP statement used a delimiter before it had been declared. (Bug #53853)

• In the SQL Editor, deleting a snippet from the snippet list using the toolbar button caused the first snippetto be deleted, regardless of which snippet was selected. (Bug #53860)

• In the Columns tab of the Table Editor, automatic data type completion did not occur if the type wasentered in lowercase. MySQL Workbench now completes the data type regardless of lettercase. (Bug#53710)

• In the SQL Editor, if a query was executed and then interrupted, MySQL Workbench hung. (Bug #53652)

• When a model containing a table using a 1:n relationship was synchronized with a live database, therelationship then failed to render in the EER Diagram. (Bug #53252)

• It was not possible to edit schema properties in the schema editor, such as name and default collation.(Bug #53438)

• If a query was entered in the SQL Query tab, and then Command+Enter was immediately pressed toexecute the query, the query failed. This only happened on Mac OS X. (Bug #53650)

• MySQL Workbench crashed when attempting to connect to a Linux server using an SSH connection.(Bug #53476)

• The MySQL configuration file was corrupted by the Administrator when changes were applied, if theconfiguration file was not terminated with a new line. (Bug #53620)

• If a Workbench model file was double-clicked, MySQL Workbench crashed on launch. However, ifMySQL Workbench was started using its application icon, and then the same model file was loaded fromwithin MySQL Workbench, no problems were encountered. (Bug #49941)

Page 389: MySQL Workbench

Changes in Release 5.2

381

• When scrolling in an EER Diagram, MySQL Workbench repeatedly displayed an error dialog containingthe message “OpenGL error: invalid value”. (Bug #52840)

• In the EER Diagram view, when the diagram was displayed over multiple pages, the gray line dividingpages in the Navigator was not visible in the diagram itself. (Bug #50243)

• Zooming out from a diagram in EER Diagram view resulted in severe flicker. (Bug #50240)

• Attempts to forward engineer a project that contained a view failed with this error:

ERROR: Error 1046: No database selected

(Bug #51091)

• In the Data Dump section of the Administrator, when a schema was dumped to multiple files, the storedroutines were not exported. (Bug #52798)

• In the Alter Table dialog of the SQL Editor, entering a column comment in the Comments tab andapplying the changes did not save the comment. (Bug #52893)

• In the SQL Editor, carrying out a SELECT on a table containing more than 1000 columns resulted in theerror Too many SQL variables. (Bug #50952)

• In the Triggers tab of the Table Editor, if a trigger was written that contained a DROP TRIGGERstatement, the statement was automatically removed. (Bug #53023)

• When synchronizing to a live database, triggers showed as requiring updating, even when the model andlive database were identical. (Bug #51409)

• Inserts added to a model and saved on Windows were not visible when that model was loaded on MacOS X. (Bug #51029)

• In the Manage DB Connections dialog, selecting Use ANSI quote to quote identifiers had no effectwith respect to subsequent queries using that connection. (Bug #53160)

• In the Connections tab of the Administrator, queries containing a comment did not always displaycorrectly in the Info column. (Bug #51848)

• Setting WB_NO_GNOME_KEYRING=1 on Kubuntu did not appear to disable the Gnome keyring. It wastherefore impossible to connect without an active keyring daemon. (Bug #52866)

• It was not possible to set ON UPDATE CURRENT_TIMESTAMP as the default value for a column. (Bug#52350)

• In the EER Diagram view, when zoomed out, a layer could be placed beyond the diagram's perimeterat the bottom right. Further, if a layer was placed beyond the perimeter at the top left, it snapped backwithin confines of the diagram correctly, but the navigator view was not updated accordingly. (Bug#50242)

• In the EER Diagram view, it was not possible to paste a copied layer. The paste menu item was disabledin the context-sensitive menu and main menu, and pressing Control+V had no effect. (Bug #50253)

• When using Create EER Model from SQL Script from the Home screen, the specified engine type wasnot present in the resulting EER model. (Bug #49568)

• Output did not scale correctly for print sizes other than A4. (Bug #51515)

• In the Connections tab of the Administrator facility, host names that contained a '-' character weresometimes not displayed correctly. (Bug #51119)

Page 390: MySQL Workbench

Changes in Release 5.2

382

• In the SQL Editor, if the Add Table facility was used to create a new table with the same name as anexisting table, then after changes were applied, the content of both tables was the same as the existingtable, and changes unique to the second table were lost. (Bug #51107)

• Delimiters were erroneously added to trigger code if the currently selected schema was changed. (Bug#53151)

• If a table was dragged from the catalog tree on to the EER Diagram, the catalog tree collapsed. (Bug#51862)

• Loading a large script was loaded into the SQL Editor resulted in an out of memory exception. Memoryexhaustion was caused by inefficient end of line conversion. The SQL Editor now supports custom endof line formats and preserves the original line endings used in the file. End of line conversion is no longerused and large files load faster and more efficiently. (Bug #53190)

• MySQL Workbench generated an exception when an attempt was made to change the configuration filein the System Profile tab of the Manage Server Instances dialog. (Bug #52947)

• If an SQL file saved in Windows file format was loaded into the SQL Editor, it was displayed withadditional line breaks, and the SQL code was not interpreted correctly. Further, if code written in the SQLeditor was saved to a file and then opened in an editor on Windows, it contained additional line breaks.(Bug #51308)

• In the Model Overview page, when small icons view was selected, if table names were truncated, therewere no tooltips to enable visibility of the full names. The tooltips, however, were present for the largeicons view, and the details view. (Bug #50739)

• MySQL Workbench reported a server as not running, even if it was. The MySQL Server concerned wasrunning on 64-bit Windows 7. (Bug #50585)

Changes in MySQL Workbench 5.2.21 (12 May 2010, Release Candidate)

First release candidate. This section documents all changes and bug fixes applied since the release of5.2.20.

Functionality Added or Changed

• MySQL Workbench now includes the following menu items and keyboard shortcuts:

• Execute Current Statement, Control+Enter

• Execute (All or Selection), Control+Shift+Enter

• Explain Current Statement, Control+Alt+Enter

• Explain (All or Selection), Control+Alt+Shift+Enter

The Stop toolbar button and menu item now are automatically enabled and disabled. (Bug #50911)

• MySQL Workbench now features a check that compares the mysqldump version on the client andserver machines. (Bug #52689)

Bugs Fixed

• On Mac OS X, the overlay text for NULL and BLOB fields was missing from the results grid in the SQLeditor. This meant that those fields appeared empty if a query was executed that returned a BLOB, suchas SELECT SHA1('hello');. (Bug #53335)

Page 391: MySQL Workbench

Changes in Release 5.2

383

• When forward engineering a model to a database, not all tables were created on the live database. (Bug#53506)

• Proceeding through the Edit Table Data wizard (launched by the Edit Table Data action item on theHome screen) and clicking Finish to complete the wizard caused MySQL Workbench to crash. (Bug#53511)

• In the SQL Editor, if some script text was highlighted, when Control+S was pressed to save the script toa file, only the highlighted text was saved. (Bug #53275)

• Russian characters were not displayed correctly in the SQL Query tab of the SQL Editor. (Bug #53408)

• It was not possible to give the index name and foreign key name of a column different names. Nowrenaming an index in MySQL Workbench does not automatically rename a corresponding foreign key.Renaming a foreign key automatically renames the associated index only if the names still match at thetime the foreign key is renamed. (Bug #53370)

• If a socket/pipe connection method was used, and the password was stored in the keychain, MySQLWorkbench could not connect to the server. (Bug #53355)

• An error was generated when a server was selected from the Import/Export MySQL Data dialog,displayed after clicking the Manage Import/Export action item on the Home screen. (Bug #53271)

• The Edit SQL Script action item on the Home screen failed to load and execute the script. (Bug #53359)

• Changing the fonts in the Workbench Preferences dialog had no effect on the appearance of MySQLWorkbench. (Bug #53321, Bug #49832)

• In the modeler, if a table was double-clicked to open it in the Table Editor, and then, without closingthe Table Editor, another table was double-clicked to open it, the Table Editor was rendered as a blankpanel. (Bug #53250, Bug #53347)

• In the SQL Editor, if a BLOB field containing an image was loaded into the Viewer, the image was notdisplayed. (Bug #53245)

• It was not possible to delete a trigger from the Triggers tab in the Alter Table dialog. Even though thetrigger code was selected and deleted, and then Apply clicked, the code that was generated did not dropthe deleted trigger as expected. (Bug #52955)

• It was not possible to increase the font size of text in the SQL Editor. MySQL Workbench has beenchanged so that fonts set in the Workbench Preferences dialog now also affect the SQL Editor. (Bug#52968)

• In the SQL Editor the Find and Replace facility did not appear to function. (Bug #52251)

• When editing table data in the SQL Editor, the table would refresh after data was edited in the firstcolumn. This meant it was necessary to then scroll to the bottom of the table data to continue editing therecord. (Bug #51965)

• In the Alter Table dialog of the SQL Editor, there was no effective way of altering a foreign key. Also, theColumn and Referenced Column were not updated when a foreign key was created in the Foreign Keystab. (Bug #51124, Bug #51262)

• If the name of a table was changed in the Alter Table dialog and Apply was clicked, the message “nochanges to object were detected” was received, even though a change had been made. (Bug #50894)

• In the Alter Table dialog of the SQL Editor, if two triggers were created, the second with a badcommand, and the error corrected, then when changes were applied, the generated code was incorrect,dropping both triggers. (Bug #52997)

Page 392: MySQL Workbench

Changes in Release 5.2

384

• When the SQL Editor was launched, MySQL Workbench became overloaded, due to a large number oftables (10,000+) in the schema. MySQL Workbench now includes two new options in the WorkbenchPreferences dialog: Disable Live Schema Overview and Show Schema Names Only in CatalogList. This enables the application to be configured to handle schemata with large numbers of tables.(Bug #50701)

• In the SQL Editor, if multiple Query tabs were opened so that they used more than the available screenwidth, it was not possible to move to the tabs that were not visible. MySQL Workbench now includesscroll buttons should the number of tabs exceed the screen width. The scroll buttons make it possible toaccess non-visible tabs. (Bug #53070)

• MySQL Workbench crashed after using the Edit SQL Script action item from the Home screen. In theEdit SQL Script wizard, a connection was chosen that did not use a stored password, and then a scriptselected and the Finish button clicked to exit the wizard. MySQL Workbench subsequently crashed whenthe requested password was entered into the dialog and the OK clicked. (Bug #53247)

• If a model was saved using a file name that contained non-English characters, it could not be reopenedfrom the list of existing models on the Home screen. (Bug #53110)

• If a model was forward engineered to a database, renamed, and then forward engineered again, theSQL that was generated was erroneous. (Bug #53068)

• Changes to EER Diagram page size using File, Page Setup were not reflected in the model navigator.(Bug #52077)

• Any columns that contained a comment were marked for change when synchronizing the model with thelive database. (Bug #51765)

• In trigger code, triggers using the alias new were correctly colored by the syntax highlighter, but triggersusing the alias old were not. (Bug #51061)

• When an EER Diagram layout was set to span multiple pages and then printed, the diagram was printedso small as to be illegible. (Bug #51032)

• When MySQL Workbench was maximized, it did not fit correctly onto the screen and the title bar was notdisplayed. (Bug #50975)

• The Relationship and Layer editors did not close if the object they were editing was deleted. MySQLWorkbench now supports auto-closing of all open editors, should the object being edited be deleted.(Bug #50681)

• MySQL Workbench permitted setting the auto-increment check box for multiple columns in the TableEditor. (Bug #49278)

• In the Select Changes to Apply page of the Synchronize Model with Database wizard, if a schemawas selected and then any of the Update Model, Ignore, or Update Source buttons was clicked, thischange was not applied to child objects of the schema. (Bug #45454)

• MySQL Workbench permitted the creation of invalid foreign keys that referenced a column that did notuse a PRIMARY KEY or UNIQUE key declaration. MySQL Workbench now filters the list of columnspermitted for a referenced foreign key, so that only primary key and indexed columns are listed. (Bug#53136)

• Find was always enabled, even in contexts where it had no useful functionality. (Bug #49293)

• Selecting Plugins, Utilities, Test filters produced an unexpected error:

Error calling WbAdmin.openFilterDebugger

Page 393: MySQL Workbench

Changes in Release 5.2

385

The Filters Debugger facility can now be accessed in the Manage Server Instances dialog. It is locatedon the Server Stats sub-tab of the Server Profile tab. (Bug #52655)

• Diagram names containing an ampersand were not displayed correctly in the Model Overview. (Bug#51617)

• If a PDF is generated of the EER Diagram and the resulting PDF file is viewed in Acrobat Reader,MySQL Workbench crashed if an attempt was made to reprint the diagram (overwriting the file that wascurrently opened in Acrobat Reader). (Bug #50408)

• Using the Compare and Report Differences in Catalogs wizard caused MySQL Workbench to crash.(Bug #49561)

• In the Inserts tab of the Table Editor, if characters were entered into an integer column, MySQLWorkbench crashed when a new column was selected. (Bug #53066)

• In the EER Diagram view, changing the page orientation to landscape using File, Page Setup causedmultiple problems in MySQL Workbench. The Navigator orientation did not change, the diagram did notprint at the correct size, and MySQL Workbench eventually crashed. (Bug #50861)

• In the User Defined Types dialog (launched using the main menu item Model, User Defined Types),selection of the UNSIGNED or ZEROFILL check boxes was not reflected in SQL code generated by theForward Engineer SQL Script wizard. (Bug #50323)

• Synchronize to live database failed when the model contained triggers. (Bug #52939)

• If some changes were made in the Table Editor, and the editor was still in edit mode, the active changesin the Table Editor were not saved when the model was saved. (Bug #50006)

• The default Export Directory Path in the Workbench Preferences dialog was given as DriveLetter:\MyDocumentsPath/dumps. This mixed the '/' and '\' directory separators.

Further, the preferred Export Directory Path set in the Workbench Preferences dialog was not reflectedin the Export to Disk section of the Data Dump facility in the Administrator. (Bug #51519)

• In the Alter Table dialog of the SQL Editor, it was not possible to create new Foreign Keys. (Bug#53134)

• In the SQL Editor, if the table data was edited, attempts to apply the changes did nothing. (Bug #52705)

• In the SQL Editor, when the Alter Table context-sensitive menu option was used on a table and changeswere made, it was not possible to save them because the dialog reported that no changes to the objecthad been detected. (Bug #52786)

• If a table was copied in the modeler, the copy of the table was renamed. However, foreign keyrelationships contained within the table were not renamed. (Bug #53020)

• In the Administrator tab of the Workbench Preferences dialog, the description to the right of the textfield Path to mysql Tool was incorrect. (Bug #53201)

Changes in MySQL Workbench 5.2.20 (27 April 2010)

This section documents all changes and bug fixes applied since the release of 5.2.19.

Functionality Added or Changed

• The SQL Statements tab and the record set data editor tab now indicate when they have unsaved databy displaying an asterisk character. (Bug #52799)

Page 394: MySQL Workbench

Changes in Release 5.2

386

• If MySQL Workbench was used on an external monitor as part of an extended desktop, then when thecomputer was started without the external monitor, MySQL Workbench was not displayed on the primarydisplay, and was therefore invisible. MySQL Workbench now checks for this condition and locates halfof the application window on the primary desktop where it can be dragged and resized as required. (Bug#52703)

• The foreign key/index mapping implementation has been changed so that indexes created for foreignkeys no longer need be marked as FOREIGN. They now are created with type INDEX and can bechanged to UNIQUE or other types.

Although the artificial FOREIGN index type has been removed, MySQL Workbench still automaticallycreates and maintains indexes for each foreign key by naming them after the keyname and keeping thenames (FK to IDX) synchronized. (Bug #48728)

Bugs Fixed

• In the SQL Editor, when a new tab was created, the focus was on the Object Explorer, rather than inthe SQL Statements area. This meant that the user had to press the Tab key, or click within the SQLStatements area before they could start typing SQL code. (Bug #50711)

• In the Snippets tab of the SQL Editor, there appeared to be a third column, with no heading or data, inthe snippets list. MySQL Workbench now expands the second column to fill the available space. (Bug#52559)

• In the SQL Editor, when commands were entered into the SQL Statements area, and executed, theyappeared on the Output tab. However, when the number of statements appearing in the Output tabexceeded the number that could be displayed in the default area, a vertical scrollbar did not appear. Thismeant any further statements that were executed were effectively hidden because it was not possible toscroll vertically to display them. (Bug #53156)

• In the SQL Editor, field data of type VARBINARY viewed using the Open Value in Viewer context-sensitive menu item was displayed only up to the first null byte (\0). (Bug #52954)

• Script editors, such as the editor in the SQL Editor, that used the Scintilla component, did not have fullintegration with the Edit menu. Short cuts and menu commands for operations such as copy, paste,select all, and find were not implemented. (Bug #52834, Bug #51806)

• In the Variables tab of the Administrator, variables with long descriptions were not displayed correctly.They appeared wrapped to a new line, and clipped by the height of the Description row. (Bug #53025)

• Each time an Admin tab was started an instance of cscript.exe was executed. However, when theAdmin tab was closed the corresponding cscript.exe process was not terminated. This resulted inever increasing numbers of cscript.exe processes, which consumed resources unnecessarily, andconstituted a resource leak. (Bug #51601)

• In the Export to Disk tab of the Administrator's Data Dump facility, selecting multiple schemata forexport to a self-contained file resulted in this exception:

unhandled exception: local variable'tables' referenced before assignment.

(Bug #52981)

• If an SQL statement was selected in the SQL Statements area of the SQL Editor, and copied to thesnippets list using the Save SQL to Snippets List toolbar button, then the statement was only partiallysaved, the beginning of the statement being missing. This only happened for lines after the first line.Also, the further down the copied statement was located, the less text was successfully copied to the

Page 395: MySQL Workbench

Changes in Release 5.2

387

snippets list. This resulted in statements further down the code being heavily truncated, with only thelatter portion of the statement being saved. (Bug #51474)

• If a snippet was deleted from the Snippets tab in the SQL Editor, after MySQL Workbench was restartedthe deleted snippet would reappear as if it had never been deleted. (Bug #51335, Bug #52558)

• SQL Editor syntax highlighting did not correctly recognize escaping of the single quote character (').Queries such as SELECT '\'' FROM DUAL; were therefore not highlighted correctly. (Bug #50324)

• If multiple SQL Editor tabs were opened, closing the last one caused MySQL Workbench to crash. (Bug#53061)

• Selecting multiple tables at the same time in the Overview tab of the SQL Editor caused MySQLWorkbench to crash. (Bug #52922)

• On Windows, if SQL Editor was using a named pipe connection, and the SQL Editor tab was closed,MySQL Workbench stopped responding to user input and had to be killed using the Task Manager. (Bug#53021)

• When switching between Model Overview Page, and EER Diagram View, MySQL Workbench incorrectlyrendered the EER Diagram View inside the Table Editor panel. (Bug #52778)

• The View Editor deleted text pasted into the editor by the user. This happened if, for example, a viewwas copied from the editor, a new view created and the copied text pasted into the new view. At thispoint the pasted text would be deleted by the auto-parsing facility of the View Editor. (Bug #52433)

• In the Columns tab of the Table Editor, if a comment was added to a column, or a column with acomment was selected, then when another table was double-clicked to load it into the Table Editor, thecomment for the column previously selected was still displayed in the inactive Comments area. (Bug#51495)

• When using the Forward Engineer SQL Script wizard, if an existing script file was selected to beoverwritten, the wizard would not continue, the file had to be deleted first. (Bug #46920)

• If a schema was opened and an object editor, such as the Table Editor was opened, MySQL Workbenchcrashed if the schema was closed and immediately reopened. (Bug #53027)

• When an EER Diagram was displayed, the Properties tab was empty. Also, if a table in the EERDiagram was selected, the Properties tab remained empty. (Bug #52971)

• The MySQL Workbench make targets, with the exception of make all, were broken by the file ext/ctemplate/Makefile. (Bug #51024)

• The MySQL Workbench configure.in configure script contained a construct incompatible withNetBSD. The script used test == instead of test =. (Bug #53175)

• While MySQL Workbench was starting up, if the Windows screensaver activated, this led tounpredictable behavior of MySQL Workbench. For example, the application could freeze, fail to redrawits main window, or display artifacts. On other occasions the application was not able to accept keyboardinput, and had to be terminated using the Task Manager. (Bug #52780)

• In the results editor of the SQL Editor, deleting more than two hundred records resulted in this error:

Attempting to Read or Write protected memory. This is often an indication that othermemory is corrupt

This happened when using either the delete key or the Delete Rows context-sensitive menu option. (Bug#52951)

Page 396: MySQL Workbench

Changes in Release 5.2

388

• If a table comment contained a single quote character, an error resulted when an attempt was made tosynchronize this with a live server. This was because the code generated by the synchronization processdid not escape single quotation marks in the table comments. (Bug #52608)

• In the Reverse Engineer Database wizard, on the Connection Options page, if the first emptyconnection was selected from the Stored Connection list, and then the Connection Method changed,the fields on the Parameters tab did not change accordingly. (Bug #51742)

• When selecting Print Preview for an EER Diagram, the objects in the preview appeared primarily asblack filled rectangles. (Bug #51513)

• In the Columns tab of the Table Editor, the bottom button of the comments scrollbar was situated toolow, making downward scrolling very difficult because only part of the scrollbar button was exposed.(Bug #51496)

• In the Reverse Engineer Database wizard, on the Select Schemata page, any schema namecontaining an underscore was displayed without the underscore character. Further, if the Alt key waspressed, the underscores appeared under the first character located after where the underscore shouldhave been displayed, giving the character the appearance of being an accelerator key. (Bug #51141,Bug #52965)

• MySQL Workbench crashed when the root user, located in the Server Access Management tab of theAccounts facility in the Administrator, was clicked. (Bug #50703)

• MySQL Workbench failed to compile from source due to a missing #include <stdarg.h> statementin the file library/sql-parser/include/myx_sql_tree_item.h. (Bug #52919)

• In the EER Diagram view, layer objects did not respond to edit commands (either double-clicking orusing the Edit Layer context-sensitive menu option). (Bug #52822, Bug #52823)

• In the Columns tab of the Table Editor, if a column was right-clicked on, and then Move Up selected,the column ordering was not updated within the Columns tab, until the area was clicked again. (Bug#51139)

• When MySQL Workbench was sized to 1280 x 800, the Start Export button was not visible in the Exportto Disk tab of the Data Dump facility. (Bug #52932)

• When building MySQL Workbench, the build process failed if the --no-copy-dt-needed-entrieslinker option was specified (this happens by default when building on Fedora 13). (Bug #52918)

• The HUD blocked access to other applications that were running. This was particularly a problem whenAdministrator or SQL Editor were launched from the Home screen, and took a long time to load. (Bug#53006)

• The MySQL Workbench dependency on libmysql has changed to use version 16 of the library ratherthan 15. (Bug #52682)

• Print to PDF, Print to PS File, and all export functions did not work correctly. For example, if Print to PDFwas selected, MySQL Workbench would attempt to open a new document, and if the user proceeded,the current document would be closed.

Further, selecting the menu option Save Model As resulted in the Open Document dialog beingdisplayed. If the user clicked Yes the application became stuck in a loop, if No was clicked an errordialog was displayed. (Bug #52909)

Changes in MySQL Workbench 5.2.19 (16 April 2010)

This section documents all changes and bug fixes applied since the release of 5.2.18.

Page 397: MySQL Workbench

Changes in Release 5.2

389

Functionality Added or Changed

• In the Configuration tab of the Administrator, the list showing the section in the configuration file hasbeen changed to a read-only control. (Bug #52443)

Bugs Fixed

• In the SQL Editor, the Alter Schema dialog had a comments field. However, the comments enteredwere not used in the generated DDL code. The comments field no longer appears. (Bug #49280)

• In the SQL Editor, the syntax highlighter coloured two dashes as a comment. This was incorrect becausetwo dashes should be highlighted as a comment only when followed by a space. (Bug #51596)

• MySQL Workbench appeared to perform a Save As operation rather than a Save operation whensaving a modified script file in the SQL Editor. Also, there was no indication that the file being worked onhad unsaved changes (this is normally indicated by '*' in the title bar). Finally, the file name was notdisplayed on the SQL Editor tab. (Bug #50055, Bug #51373)

• The File, Open Recent menu item was not being populated with recently opened script files. (Bug#50053)

• MySQL Workbench crashed when carrying out most tasks in the SQL Editor including adding tables,adding columns, and altering tables. (Bug #52789)

• In the Table Editor of the MySQL Model page, and the Alter Table dialog of the SQL Editor, the textlabel “comments:” was truncated to “commen”. (Bug #50765)

• In the EER Diagram view, using the context-sensitive menu items Copy table, or Edit in New Windowresulted in this error:

plugin:wb.edit.editSelectedFigureInNewWindowCannot execute pluginA model diagram must be selected.

(Bug #50649)

• In the EER Diagram view, when typing a new value into the Navigator Zoom input control, the zoomlevel of the diagram changed as the new value was being entered. The diagram should only have beenredrawn when the new value being entered in was fully entered by pressing the Enter key, instead ofchanging dynamically as the zoom level value was being entered. (Bug #48597)

• In the EER Diagram view, if the cardinality of a relationship was changed and then an attempt made toedit a second relationship, the cardinality of the first relationship was applied to the second relationship.(Bug #46906)

• When two routine groups were being edited, and in both cases the Routines tab was selected to displaythe SQL code, switching between the routine groups did not result in the target Routines tab contentsbeing updated. For example, if routines1 was being displayed and the routines2 selected, theroutines1 code continued to be displayed in the Routines tab. (Bug #49432)

• In the Data Dump facility of the Administrator, if Export to Self-Contained file was selected and adestination file explicitly chosen, the selected schema was deselected on return from the file chooser.(Bug #51797)

• The internal script MySQL Workbench used to add a new user to MySQL Server was incorrect. AfterMySQL Workbench was started, it was possible to create a new user, but attempts to create additionalusers resulted in an unhandled exception. (Bug #50947)

Page 398: MySQL Workbench

Changes in Release 5.2

390

• When opening a connection to start querying from the Home screen, the HUD displayed correctly.However, an error occurred with the connection, and the error dialog was displayed beneath the HUD.This meant it was not possible to click the dialog, although pressing ESC cleared it. The error dialogshould have been displayed in front of the HUD, making it clickable. (Bug #52812)

• The MySQL Workbench preference to locate the sidebar on the right did not work. Further, the ToggleSidebar button did not function. (Bug #52631, Bug #53072)

• Attempting to build MySQL Workbench using the LDFLAGS="-Wl,--as-needed" linker options failed.(Bug #52570)

• MySQL Workbench listed gtkmm 2.4 as a dependency in configure.in. However, it used featuresonly available in later versions of this library. (Bug #52406)

• In the Object Browser of the SQL Editor, if a schema was dropped, the schema concerned wasnot removed from the Object Browser, but another schema was. However, if the connection wassynchronized, the Object Browser displayed the correct information. (Bug #51919)

• MySQL Workbench crashed when creating a foreign key relationship in the EER Diagram view. (Bug#51602)

• Double-clicking a model file (*.mwb) to open it caused MySQL Workbench to crash. (Bug #52838)

• When trying to open a saved model file, MySQL Workbench generated this error:

error executing plugin wb.file.openModel: Internal error:wait box creation must be done on the main thread

(Bug #52851)

• In the SQL Editor, when altering a routine, if the Apply SQL Script button was clicked, MySQLWorkbench froze. (Bug #52853)

• The Assigned Privileges list on the Privileges tab in the View Editor lacked default grant options suchas SELECT, UPDATE, and DROP. (Bug #42157)

Changes in MySQL Workbench 5.2.18 (13 April 2010)

This section documents all changes and bug fixes applied since the release of 5.2.17.

Functionality Added or Changed

• MySQL Workbench now features the ability to copy field data in the SQL Editor results tab in quoted orunquoted mode. (Bug #51041)

Bugs Fixed

• The Connection Information panel in the SQL Editor did not display information for the User field. (Bug#52560)

• In the Alter Table dialog of the SQL Editor, in the columns or indexes tab, the first right-click inthe dialog central area failed to display the context-sensitive menu. However, it was displayed onsubsequent clicks. (Bug #51796)

• In the SQL Editor, it was not possible to export a result set, if the result set was not the first result set.For example, if there were two result sets, it would be possible to export the first one created, but not thesecond result set. (Bug #51595)

• In the Alter Routine dialog of the SQL editor, there was inconsistency between the operation of theclose dialog button ('X') on the top right of the window, and the Close button on the bottom right. When

Page 399: MySQL Workbench

Changes in Release 5.2

391

using the close dialog button you were prompted to save changes, regardless of whether you actuallychanged the routine or not. When using the Close button, the user was not prompted, even if the routinehad changed. (Bug #51518)

• When editing a row in the SQL Editor, if a column was NOT NULL and had a default value, and a valuewas not entered for it, then after changing another column if changes were applied an error would begenerated. This was because the editor attempted to set the NOT NULL column to NULL, rather than toits default value. (Bug #50781)

• The Triggers tab in the Alter Table dialog of the SQL Editor erased all entered code, when an attemptwas made to copy and paste text within the tab. (Bug #52587)

• In the SQL Editor, if in the Alter Routine dialog, the user had a routine that contained an error, theroutine would be lost if an attempt was made to close the Alter Routine dialog using the close button,and then click Yes to apply changes. (Bug #51921)

• In the SQL Editor, in the results editor, it was not possible to edit or copy data containing multiple lines oftext. Further, lines containing new lines were displayed as if the new lines did not exist.

MySQL Workbench now includes a blob editor. This can be accessed by right-clicking in the field to editand selecting Open Value in Editor. (Bug #51561)

• In the SQL Editor, right-clicking a row in the results editor (after double-clicking a table), and selectingdelete from the context-sensitive menu, did not have any effect. (Bug #51361)

• In the SQL Editor, if a routine was altered in the routine editor, it was possible to close the editor withoutthe editor prompting you to save any changes made, and so changes were lost. (Bug #52728)

• The Log text area in the Reverse Engineer SQL Script wizard was inactive, preventing the logmessage from being scrolled. (Bug #50758)

• On the Linux platform, no context-sensitive menu was displayed when right-clicking a schema tab in thePhysical Schemata section of the MySQL Model page. (Bug #49429)

• In the EER Diagram view, when a table with a name containing underscores was right-clicked, thecontext-sensitive menu displayed menu items containing the table name without the underscores. (Bug#49314)

• In the MySQL Model page it was not possible to delete a schema by using the context sensitive menu inthe Physical Schemata section. (Bug #48055)

• MySQL Workbench crashed if No in the Delete Object dialog was clicked when attempting to delete aview from an EER Diagram. (Bug #52310)

• MySQL Workbench crashed when an attempt was made to create an EER Diagram from a databasecontaining a large number of tables (1500+). (Bug #52500)

• The Data Dump facility in the Administrator exported the entire schema into a single file when the DumpViews option was selected. Further, if tables were selected and the Dump stored routines optionselected, the routines would be stored in their own file, but with the DROP PROCEDURE IF EXISTSstatements missing. (Bug #52579)

• During the import procedure of the Data Dump facility in the Administrator, stored routines were notimported. (Bug #52577)

• When using the Forward Engineer SQL Script wizard, the wizard did not terminate DROP procedureIF EXISTS statements with a semicolon. This caused SQL syntax errors if the script was executed on aserver. (Bug #52743)

Page 400: MySQL Workbench

Changes in Release 5.2

392

• The scrollable boxes on the Home screen did not respond to mouse wheel events. (Bug #51213)

• The model Navigator did not redraw itself correctly. The Navigator worked correctly for the first modelloaded into MySQL Workbench, but not for subsequently loaded models. (Bug #50580, Bug #50622)

• In the Object Explorer of the Sidebar, if an existing table was right-clicked, the context-sensitive menudisplayed the option Create Table.... However, selecting this option appeared to have no effect. (Bug#51570)

• The Message Log text area in the Forward Engineer to Database wizard was in active, preventingscrolling of the message when an error occurred. (Bug #51417)

• When editing a table in the SQL Editor, the context sensitive menu items did not affect the row underthe cursor, but a previously selected row. This potentially led to the unintentioned deletion of a row. (Bug#50113)

Changes in MySQL Workbench 5.2.17 (02 April 2010)

This section documents all changes and bug fixes applied since the release of 5.2.16.

Functionality Added or Changed

• MySQL Workbench has been changed so that it is possible to run the start, stop, and check statusscripts executed from the Administrator, with administrator privileges. A check box has been providedto enable you the option of acquiring the administrator rights to execute the commands. This option isswitched off by default for the check status command. (Bug #51276)

• The MySQL Workbench installer now includes a Launch Now check box. By default, this is selected, soMySQL Workbench will be launched when the installer exits. (Bug #50387)

• The Execute Current Statement command in the SQL Editor has been improved. The statement thatcontains the cursor will be executed. Further, if the cursor is outside of a statement, the last statementbefore the cursor is executed. (Bug #52302)

• The WeifenLuo library was removed. This was the cause of difficult to trace application crashes. (Bug#50706)

• The Output window only appeared in the Model context. MySQL Workbench has been changed so thatthe Output window now has its own tab on the main screen. (Bug #48988)

• If MySQL Workbench attempts to connect to MySQL Server version 4.x, an error message is generatedto indicate this version is not supported. (Bug #51455, Bug #51844)

• Various improvements to the SQL Editor user interface, including additional context-sensitive menuitems in the Object Explorer, additional buttons in the Create Table and Alter Table dialogs, and moreclearly displayed error messages. (Bug #50637, Bug #49918)

• A description column has been added to the snippets table. (Bug #51010)

• In the SQL Editor, the Comments tab in the Create View dialog has been removed. (Bug #49270)

Bugs Fixed

• In the Output tab of the SQL Editor, if a query produced an error response, it was difficult to read thereturned error message. The message could only be read using mouse-over in the Response column,and the error message text could not be copied. The Response column is now renamed to Message.Further, the Message column has been widened, and new Action and Message detail panels havebeen added, making it easier to read error messages. (Bug #50629, Bug #50860)

Page 401: MySQL Workbench

Changes in Release 5.2

393

• On the Output tab of the SQL Editor, it was not possible to properly view the contents of the Action andMessage columns, if the text exceeded the standard column width.

MySQL Workbench has now added a detail panel, so that long messages can be easily viewed. (Bug#51040)

• It was not possible to connect to the MySQL server with MySQL Workbench if using sockets. (Bug#51419, Bug #51460)

• The Table Editor, Routine Editor, and other object editors stayed open, even if the user switched fromthe MySQL Model page to the SQL Editor page, Home screen, or Administrator page, thereby causingconfusion. (Bug #49367)

• In the EER Diagram view, when zooming in or out of the diagram the screen was not redrawn correctly.(Bug #48020, Bug #48032, Bug #34505)

• If, in the EER Diagram view, an attempt was made to edit two tables, MySQL Workbench crashed. (Bug#52158)

• This bug occurred when using the MySQL Workbench Administrator with MySQL Server version 5.0.When selecting Enable General Log in the Administrator's configuration page, MySQL Workbenchattempted to add the option general-log to the configuration file, even thought this is not supported byMySQL Server 5.0. (Bug #49011)

• In the EER Diagram view, when the menu item Model, Diagram Properties and Size was selected fromthe main menu, MySQL Workbench crashed. (Bug #52065, Bug #52375)

• In the Alter Routine dialog of the SQL Editor, when a routine was changed, and the changessuccessfully applied using the Apply SQL Script to Database dialog, the Alter Routine dialog stillprompted the user to apply changes, even though the changes had already been successfully applied.(Bug #49273)

• In the live editing tab of the SQL Editor, if the Alt+Tab key combination was used, the ascending anddescending sort order of the columns could no longer be changed. (Bug #49366)

• If a long running SQL query was executed in the SQL Editor, and then the SQL Editor tab closed,MySQL Workbench crashed if a new connection was started from the Home screen. This exception wasgenerated:

Unknown Exception: caught in c:\documents andsettings\mysqldev\build\mysql-workbench-oss-5.2.16\backend\windows\wbprivate.wr\src\Wb.hat line 1087

(Bug #51467)

• In the Alter Table dialog of the SQL Editor, if a column was added to a table, and then an attempt madeto alter that column's data type, the wizard generated ADD COLUMN code, rather than CHANGE COLUMN.That resulted in this error when an attempt was made to apply the changes:

ERROR 1060: Duplicate column name 'test_column'

(Bug #51516, Bug #51719)

• In the SQL Editor, when an SQL query was entered that contained a large number of characters,it appeared full width in the action column of the Output tab, causing the Response column to beunacceptably narrow. (Bug #51550)

• The Alter Table dialog in the SQL Editor displayed comments with a single quote character prependingit, and with the last character of the comment truncated. (Bug #51972, Bug #52297)

Page 402: MySQL Workbench

Changes in Release 5.2

394

• When switching from a tab such as the SQL Editor tab to the Home screen, the toolbar did notchange accordingly. However, the buttons on the toolbar were still active, leading to the possibility ofunintentional actions. (Bug #49147)

• In the SQL Editor, the wrong table was displayed when using EDIT. This happened if two schematacontained tables with the same name. For example, if two schemata, schema1 and schema2 bothcontained a table t1, then if the following SQL was entered and executed, schema2.t1 would bedisplayed instead of schema1.t1:

use schema1;edit t1;

(Bug #52401, Bug #52692)

• When a model with a view was exported using File, Export, Forward Engineer SQL CREATE Script, asemicolon was added to the end of the CREATE VIEW statement, even if one was already present fromthe view code entered. (Bug #51416)

• In the Routine Editor, the editor added “//” as the last delimiter, even though “DELIMITER $$” was usedat the beginning of the code. (Bug #51247)

• In the SQL Editor, field names containing an underscore were displayed incorrectly on the Resultstab. Instead of the underscore being displayed in the correct location the following character appearedunderlined. (Bug #50132)

• In the SQL Editor, in a result set tab it was not possible to copy values from the result set. MySQLWorkbench now includes the context sensitive menu items Copy row values and Copy field content.(Bug #49683, Bug #50170)

• In the Overview tab of the SQL Editor, if there were a large number of schemata, it was not possible toaccess certain schemata because they did not all fit on the schema tab control.

MySQL Workbench has been changed so that there is now a small drop down control that enables youto select the required schema, even if it is not currently visible on the schema tab control. (Bug #48898,Bug #50169)

• In the Alter Table dialog of the SQL Editor, when a table was edited and changes applied, if subsequentchanges were made and applied an error would result, as MySQL Workbench attempted to use ADDCOLUMN rather than CHANGE COLUMN. (Bug #51481)

• MySQL Workbench crashed while attempting to edit code in the SQL Editor. (Bug #51815)

• If a connection was opened for querying and then Control+W quickly pressed to close the connection,MySQL Workbench would crash. (Bug #51685)

• MySQL Workbench crashed when synchronizing a model to a live server. (Bug #51892)

• When synchronizing a model containing a large number of Stored Routines, not all routines weresynchronized with the live server. (Bug #51731)

• When synchronizing between two triggers, unexpected USE statements and the comment “-- TriggerDDL Statements” appeared intermittently. This caused a syntax error in the script. (Bug #51728)

• In the Administrator section of MySQL Workbench, if a new user was created, the password was notcorrectly applied for the account, resulting in the new user being denied access when an attempt wasmade to connect to a server with that user account. (Bug #50983, Bug #51464)

• When Manage Import / Export was clicked on the Home screen, a server instance selected, and thenOK clicked, MySQL Workbench displayed an error dialog with this message:

Page 403: MySQL Workbench

Changes in Release 5.2

395

MySQL Workbench has encountered a problem, External component has thrown anexception.

(Bug #51477, Bug #51665, Bug #51703, Bug #51733, Bug #51800, Bug #51870, Bug #51895, Bug#51963, Bug #51944, Bug #51999, Bug #52052, Bug #52262)

• When using the option Omit Schemata Qualifier in Object Names in the Forward Engineer dialog,the schema name still appeared in DROP, CREATE SCHEMA, INSERT and USE statements. The schemaname also appeared in the table comments. (Bug #46837, Bug #51411)

• Building MySQL Workbench from source failed if LDFLAGS="-Wl,--as-needed" option was specified.(Bug #51469)

• MySQL Workbench crashed if objects were sequentially selected in the EER Diagram view. (Bug#51573)

• When using the main menu item Scripting, Run Workbench Script File, the dialog appended “.lua” to theselected file name. This resulted in a failure to load the desired file. (Bug #50501)

• When a schema with Foreign keys and associated automatically generated foreign indexes wasexported with the Skip Creation of FOREIGN KEYS check box selected, the generated script stillcontained the indexes. (Bug #49987)

• In the SQL Editor, if a foreign key name was changed using the Foreign Key tab or Indexes tab of theAlter Table dialog, this error was generated:

Type mismatch: expected type string, but got list

(Bug #51192)

• Exporting a result set to a CSV file resulted in a file with a trailing comma appended to each lineincluding the heading. (Bug #51594)

• When opening the ip2nation.sql file MySQL Workbench crashed. (Bug #51606, Bug #51531)

• After exporting a schema to disk, importing the schema did not restore the tables. (Bug #51261)

• If a server instance was created with the New Instance wizard with SSH disabled, this exceptionoccurred when attempting to administer the server instance:

Exception = System.Runtime.InteropServices.SEHExceptionMessage = External component has thrown an exception.FullText = System.Runtime.InteropServices.SEHException: External component has thrown anexception. at MySQL.Forms.DrawBoxImpl.drawbox_mouse_click(Object sender, MouseEventArgs e) at System.Windows.Forms.Control.OnMouseClick(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam,IntPtr lparam)

(Bug #51368, Bug #51476, Bug #51522, Bug #51483, Bug #51978, Bug #51810, Bug #51883, Bug#51803, Bug #52115, Bug #52163, Bug #51292, Bug #51668, Bug #51784, Bug #51789, Bug #51940,Bug #51947, Bug #52021, Bug #52028, Bug #52108, Bug #52240)

• An Out of Range exception occurred when switching from the Table Editor to the Home screen. (Bug#50980, Bug #51030)

Page 404: MySQL Workbench

Changes in Release 5.2

396

• The New Server Instance wizard did not set the correct name for the startup script, when the installationtype was set to Fedora Linux (Vendor Package). Testing the connection resulted in the error “Operationfailed: /etc/init.d/mysql start is invalid”. (Bug #51802)

• In the Object Explorer of the SQL Editor, right-clicking a table displayed the menu option Send to SQLEdtor. Editor was spelled incorrectly. (Bug #51790)

• In the Inserts tab of the Table Editor, if a row was right-clicked and Delete selected rows selected,MySQL Workbench crashed. (Bug #51584)

• On the MySQL Model tab, if a table was clicked on and edited using the context menu option Edit Table,MySQL Workbench crashed. (Bug #51410, Bug #50936)

• When the MySQL Workbench source was configured, the package gnome-keyring-1 was not found.(Bug #51090)

• The live data editor in SQL Editor did not permit the columns to be sorted in descending order by clickingthe column heading. It only permitted column sorting in ascending order through clicking the columnheading. (Bug #49302)

• In the SQL editor, if Alter Table was invoked for a table, and then the partitioning tab selected andpartitioning enabled, it was possible to select a partition count of 0, which then generated an error if anattempt was made to apply changes. (Bug #49050)

• If all screens and tabs were closed in MySQL Workbench and then Data, Manage Connections selected,then when the Manage DB Connections dialog was closed an unknown exception occurred. (Bug#51403)

• There were discrepancies between the list of pre-requisite packages given on the MySQL Workbenchwebsite and those listed in the README file in the MySQL Workbench distribution. (Bug #51085)

• In the Overview tab of the SQL Editor there was no scrolling facility available. This meant that if themodel contained a large number of schema objects the panel area was quickly filled, and it was notpossible to view all of the objects without the ability to scroll. (Bug #49290, Bug #51634)

• In the configuration settings panel of the Administrator, the ',' character was treated as part of thedatabase name, and so it was not possible to specify multiple databases for certain configurationoptions.

MySQL Workbench has been changed as follows:

Several configuration options permit multiple databases to be specified. For example, binlog-do-dband binlog-ignore-db. However, if a comma is used to delimit these databases, the comma is correctlytreated as part of the database name. This means that to specify multiple databases you must usemultiple instances of the option.

To specify multiple instances of the option, the “;” character can be used in MySQL Workbench. Whentext is entered into the option entry field and the “;” symbol detected, MySQL Workbench prompts youto select multiple instances, or leave the option entry unchanged. If selected the option will be writtento the configuration file as multiple instances. Further, when a multiple instance option is detected in aconfiguration file it is parsed into <value1> ; <value2> ; ... ; <valueN>. (Bug #15245, Bug #11745436)

Changes in MySQL Workbench 5.2.16 (17 February 2010)

This section documents all changes and bug fixes applied since the release of 5.2.15.

Functionality Added or Changed

Page 405: MySQL Workbench

Changes in Release 5.2

397

• The Manage DB Connections dialog now prevents removal of a connection used by a server instance.(Bug #50547)

• In the Logs tab of the Administrator it was not possible to view long queries, or copy their text. MySQLWorkbench has been changed so that double-clicking an entry in the Logs tab pops up a dialog with thecomplete text, and also provides a Copy Detail button to copy the text of the entry. (Bug #49442)

• In the SQL editor, the keyboard shortcut to run a single query has been changed to Control+Enter. Torun all queries the keyboard shortcut has been changed to Control+Shift+Enter. (Bug #50747)

• The data dump facility, used for exporting data to disk, has been modified to enable the --single-transaction option to be specified.

If --single-transaction is enabled, the table selection will be restricted the following ways:

• If a single schema is selected, it is possible to select/deselect its tables as required.

• If more than one schema is selected, all tables from these schemas must be selected becausemysqldump --databases will be used in this case.

(Bug #49220)

• The key sequence Control+Q has been added as a shortcut for the main menu item File, Exit. (Bug#50727)

• In the SQL Editor a comment has been added to the EDIT statement to clarify its functionality. (Bug#50705)

• When a model with multiple EER Diagrams was opened, all EER Diagrams would be displayed in tabs.This happened whether or not a EER Diagram had been displayed in a tab prior to saving the model.

MySQL Workbench has been changed so that the EER Diagram tab state is saved, so that when amodel is opened, only those EER Diagram tabs that were open on save are restored. This preventsunnecessary cluttering of the interface. (Bug #44454, Bug #50732)

Bugs Fixed

• Security Fix: Passwords were stored in plain text format in the file server_instances.xml.

To improve security MySQL Workbench has been changed in the following ways:

• The password is no longer stored in the connection XML file.

• When a connection is opened, a password request dialog is displayed and the password requested.The password can optionally be stored in the system keychain/vault/keyring.

• When editing a connection profile, you can also store the password in the system keychain.

• For compatibility, when MySQL Workbench starts it will look for passwords stored in the XML file. Ifany password is found, it will be removed from the XML file and automatically stored in the keychain.When MySQL Workbench exits, the connections file will be free from passwords.

(Bug #50194)

• The second invocation of File, Print caused MySQL Workbench to crash. (Bug #50885)

• In the SQL Editor the text “Parsing SQL ...” displayed in the status bar remained once the parsing wascomplete.

Page 406: MySQL Workbench

Changes in Release 5.2

398

MySQL Workbench has been changed to display “No errors found” once parsing has successfullycompleted. (Bug #50833)

• On the MySQL Model page using Roles and Users to grant privileges to a schema resulted in errorswhen the model was forward engineered, and the resulting script applied against a MySQL server. Thescript failed due to invalid SQL syntax because the SQL created did not correctly apply the privileges toall schema objects. (Bug #50762)

• In the SQL Editor a situation occurred where all results tabs could not be closed. Further, results tabswere incorrectly created with the same label. (Bug #50334, Bug #50865)

• When using MySQL Workbench to create an ALTER script, the generated script did not reflect columnswhere only the case of the column name had changed. (Bug #45556)

• Using File, Export, Forward Engineer ALTER Script to export a model resulted in MySQL Workbenchgenerating the exception AccessViolationException. (Bug #51053)

• When using the Server Administration link, or Manage Security link, on the Home screen, to log in toa remote server through an SSH connection, if the password dialog was closed, and cancellation of theSSH connection dialog acknowledged, this exception was generated:

Exception = System.Runtime.InteropServices.SEHExceptionMessage = External component has thrown an exception.FullText = System.Runtime.InteropServices.SEHException: External component has thrown anexception. at MySQL.Forms.DrawBoxImpl.drawbox_mouse_click(Object sender, MouseEventArgs e)...

(Bug #51088)

• In the System Profile tab of the Manage Server Instances dialog, if the Path to configuration filetextfield was set using the browse button, ..., the value in the textfield appeared to be set correctly to theselected file. However, if the dialog was closed and reopened, the new path was not displayed in the textfield. If the path was manually entered, rather than using the browse button, the textfield would displaythe correct path even if the dialog was closed and reopened. (Bug #50965)

• The messages generated by mysqldump when a data export operation failed were difficult to interpret,for example:

Operation failed with exitcode 2

(Bug #50137)

• In the Create a new server instance wizard, using the default SSH Key Path, ~/.ssh/id_rsa,resulted in a 'file not found' error when testing the connection. However, if the path was entered as /home/username/.ssh/id_rsa the connection test was successful. The same problem was alsopresent in the Manage DB Connections dialog. (Bug #49090)

• The first connection created with New Connection did not appear immediately in the list of availableconnections. (Bug #49079, Bug #49801)

• For a default MySQL Server installation, no my.ini or my.cnf file is created. This proved problematicwhen creating a server instance in MySQL Workbench because the Create a new server instancewizard expected a configuration file to be specified. If the path to the configuration file was left blank,a model error dialog was displayed by the wizard. If alternatively, one of the standard locations for theconfiguration file was entered, problems arose when an attempt was made to subsequently changeconfiguration values in the configuration section of the Admin screen. The problems included MySQLWorkbench hanging, and repetitive requests for a 'super user' password. (Bug #49766, Bug #50317)

Page 407: MySQL Workbench

Changes in Release 5.2

399

• In the Create a new server instance wizard, on the last page of the wizard if the Back button waspressed and then the Next button pressed, an error was generated stating the server instance alreadyexisted. (Bug #51060)

• The descriptions used for options in the Advanced Options tab in the Data Dump section of theadministrator were lacking clarity and in some cases dated. (Bug #49224)

• Numerous variables were missing from the DDL section of the Status Variables tab in the administrator.(Bug #49073, Bug #49077)

• In the configuration file editor it was possible to select a directory, such as Temp directory on theGeneral tab, without specifying a corresponding path. (Bug #49035)

• In the General tab of the configuration file editor, the option Default table type was present, eventhough it was deprecated in MySQL Server 5.0. Further, selecting this option and applying changes didnot change the server configuration file. (Bug #49006)

• If the command for checking server status was changed in a server instance, the change did not takeeffect unless MySQL Workbench was restarted. (Bug #48992)

• In the Create a new server instance wizard, if an operating system of type Windows (MySQL 5.1Installer Package) was selected, this error was generated on the Test Settings page:

Error: File C:\Program Files\MySQL\MySQL Server 5.1\my.ini doesn't exist

This was because the file was actually stored in C:\Programas\MySQL\MySQL Server5.1\my.ini.

Similar bugs where the configuration file could not be found were reported on both English and non-English systems. (Bug #50050, Bug #50635, Bug #50966, Bug #50873, Bug #51008)

• When using an SSH connection to manage a remote server, MySQL Workbench repeatedly promptedthe user to enter a password, even though a key file had been specified. (Bug #49307)

• MySQL Workbench did not correctly detect the status of MySQL Servers where multiple servers wererunning on the same host, and so displayed incorrect server status on the Admin screen. (Bug #48975)

• If a MySQL server was set to accept named pipe connections only, and then a server instance created inMySQL Workbench using a named pipe connection, it was not possible to subsequently connect to theserver with MySQL Workbench. (Bug #50830)

• When MySQL Workbench was connected to a remote server using an SSH connection, and a dataexport operation performed, MySQL Workbench actually attempted to perform the data export on alocal server instance, rather than on the connected remote server. If the remote and local server had acommon user account, a backup could be performed that appeared to complete successfully, but whichcontained data from the local server rather than the connected remote server. (Bug #49295)

• Expanded Schemata Palettes in the SQL Editor would collapse when switching between SQL Editortabs. (Bug #50815)

• In the SQL Editor, when using the live editor, if Query, Export Results was selected from the main menuand a CSV output format chosen, the exported data was found to be in tab delimited format, rather thanCSV format. (Bug #49303)

• In the SQL Editor, when editing table data, if an operation failed when changes were applied, the errormessage was not clearly visible. (Bug #50112)

• In the SQL Editor the toolbar button to execute SQL statements was missing.

Page 408: MySQL Workbench

Changes in Release 5.2

400

MySQL Workbench also now includes a new toolbar button to execute a single statement. (Bug #50791)

• In the SQL Editor, if the Edit Data dialog was invoked for a table, and some data edited, MySQLWorkbench crashed when the Apply SQL button was clicked. (Bug #50920)

• In the SQL Editor, in the add routine dialog, if the template was used, and a simple SELECT 1;statement added to the template, this error was generated when changes were applied:

ERROR 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3SQL Statement:CREATE PROCEDURE `world`.`new_routine` ()BEGINSELECT 1

(Bug #49710)

• In the Alter Table dialog of the SQL Editor, support for triggers appeared to be provided, but underlyingfunctionality was missing. (Bug #49287)

• In the SQL Editor, if Alter Table was invoked, and the collation for a column changed, no changes weredetected after clicking Apply. (Bug #49277)

• In the SQL Editor, if using the Alter Table dialog, attempting to apply changes after renaming an indexresulted in this error:

SQL Error 1091: Can't DROP 'username_foo'; check that column/key exists

(Bug #50970)

• In the Forward Engineer SQL Script wizard, selecting the check box Omit Schema Qualifier inObject Names caused the CREATE SCHEMA statement to be removed. DROP SCHEMA statements werealso removed, even if the Generate DROP SCHEMA check box was selected.

MySQL Workbench has been changed so that if the Omit Schema Qualifier in Object Names checkbox is selected, it is possible to optionally select the check box Insert USE Statements, to enable ordisable the use of USE statements. (Bug #49682)

• In the Forward Engineer SQL Script wizard, selection of the Skip Creation of FOREIGN KEYS checkbox was not reflected in the generated script. (Bug #47969)

• If a schema that contained tables with no engine defined was reverse engineered, and then the enginetype was changed in MySQL Workbench, then when the model was exported the ALTER script did notcontain code to change the engine of the table. (Bug #45110)

• If a table was dropped from a live database, and then the model synchronized, the dropped table wouldbe detected, but the table was not dropped from the model concerned. (Bug #50000)

• The SQL code editors used in the modeling functionality within MySQL Workbench, for example in theTriggers tab of the Table Editor, failed to identify and highlight SQL code errors. (Bug #50835)

• When synchronizing a schema with a live server, the scale of columns with type DECIMAL waserroneously set to zero. For example, a DECIMAL(17,5) was found to be set to DECIMAL (17,0) inthe generated script. (Bug #50110)

• An exported script containing triggers and views resulted in the error #1046 - No databaseselected when run on the MySQL Server. This was due to a missing USE DATABASE statement in thegenerated script. (Bug #50900)

Page 409: MySQL Workbench

Changes in Release 5.2

401

• In the Data Dump facility of the Administrator, attempting to export a schema to disk failed if a tablename contained a space. (Bug #50728)

• In the Data Dump facility of the Administrator it was not possible to import a file where the pathcontained a space. (Bug #50609, Bug #50007)

• If the Data Dump facility in Administrator was used to export to a self-contained file, then when that filewas imported an unhandled exception was generated. (Bug #49529)

• If the MySQL Server was stopped then attempting to access the Logs, Accounts, Connections,Variables or Data Dump tabs in the Administrator resulted in unhandled exceptions. (Bug #49439)

• In the MySQL Model tab, if the Table Editor was launched and then the Home screen tab clicked,MySQL Workbench displayed the MySQL Workbench Unexpected Error dialog. (Bug #50768)

• The import log contained messages with redundant parentheses. (Bug #49218)

• There was no facility to cancel the Export to Disk process, once started, in the Administrator. Further, theStart Export button erroneously remained enabled during the export process, enabling the user to startnew export processes, resulting in errors. (Bug #49115)

• In the Data Dump facility of the Administrator, if a schema was selected, but its corresponding checkbox not selected, and then several of its tables selected for export, this error occurred when the StartExport button was clicked:

Nothing to do, no schemas or tables selected.

(Bug #49110)

• When a non-SSH server instance was created, and a connection made to a remote server, only theData Dump facility of the Administrator was available. The same problem occurred if SSH-basedadministration was deselected for the server instance. (Bug #50098)

• MySQL Workbench did not support SSH keys that required a passphrase to be entered. (Bug #49418)

• In the Manage DB Connections dialog it was not possible to select a default schema for the Socket/Pipe connection type because this facility was not provided by the dialog user interface. (Bug #50283)

• In the Workbench Scripting Shell dialog, clicking an item in the value inspector panel (lower left corner)caused an exception:

System.Runtime.InteropServices.SEHException: External component has thrown anexception. at MySQL.Grt.TreeModel.expand_node(NodeId node) at MySQL.Grt.GrtTreeModel.TreeViewExpanding(Object sender, TreeViewAdvEventArgs e) at System.EventHandler`1.Invoke(Object sender, TEventArgs e) at Aga.Controls.Tree.TreeViewAdv.OnExpanding(TreeNodeAdv node) ...

(Bug #50683)

• It was possible to connect to a database using a password containing a space. However, when thisconnection was used to attempt a backup the operation failed, due to the password not being correctlyquoted. (Bug #50213)

• In the SQL Editor, if a LONGTEXT field was being edited in the table data live editor, when the changeswere applied an error was generated.

MySQL Workbench has also been changed so that large text values need to be edited in an externaleditor and then pasted into the grid cell. (Bug #50111, Bug #50692, Bug #50948, Bug #50814)

Page 410: MySQL Workbench

Changes in Release 5.2

402

• In the SQL Editor, if a database was selected in the Overview tab and then either the Drop Schema...context menu item was selected, or the drop schema toolbar button clicked, the DROP DATABASEdialog was displayed. However, if the dialog close button was then clicked to cancel the dialog, thedatabase was still dropped, instead of being unaffected by the cancelling of the dialog. (Bug #50072,Bug #50960)

Changes in MySQL Workbench 5.2.15 (28 January 2010)

This section documents all changes and bug fixes applied since the release of 5.2.14.

Functionality Added or Changed

• The GRT Shell exhibited various issues and could generate exceptions in some circumstances.

The GRT Shell has been updated and is now implemented as a standalone dialog known as theWorkbench Scripting Shell. (Bug #49298)

Bugs Fixed

• In the SQL Editor, if an attempt was made to change the number of partitions in a table, using AlterTable, the SQL code produced did not contain the necessary ALTER TABLE statement to effect thischange. (Bug #49054)

• If a model contained a table which used a user defined type for a column, then when the model wasforward engineered an erroneous COLUMN CHANGE statement was generated for the column. This onlyhappened for user defined types without additional arguments. For example, a user defined type usingINTEGER(11) would not create a COLUMN CHANGE statement, but using INTEGER would. (Bug #45834)

• If the MySQL Server was stopped outside of MySQL Workbench then the server status displayed in theAdministrator did not update correctly until the Startup tab was clicked. The log file did however correctlynote the change in status. (Bug #48966)

• If text was entered into the search bar in the SQL Editor, and the sidebar button clicked twice, MySQLWorkbench crashed. This only happened on Mac OS X. (Bug #50560)

• With an EER Diagram open, the File, Page Setup menu item was unavailable. (Bug #49863)

• The Synchronize Model with Database wizard generated a script that erroneously dropped schematathat had been selected to be ignored. (Bug #49587)

• The Portrait and Landscape icons were missing from the Page Setup dialog. (Bug #50529)

• On an EER Diagram, when a relationship was placed using the toolbar button Place a Relationship usingExisting Columns, if the relationship was subsequently checked in the Foreign Keys tab of the TableEditor, it was found to contain incorrect values for foreign key names, for example, fk_%dcolumn%1. Itwas apparent that the placeholder had not had its value correctly substituted. (Bug #50492)

• When working through the Manage DB Connections wizard, the prompt to Enter SSH passwordappeared as a sheet behind the modal dialog box for the wizard. In some situations, it was not possibleto see the Enter SSH password sheet, and it was not possible to click any buttons on, or close, themodal wizard.

This meant the user had to move the modal dialog box to see the Enter SSH password sheet, but iswas not obvious that this was possible because the window decorations indicated that the modal dialogcould not be focused.

MySQL Workbench now uses a dialog rather than a wizard used for Manage DB Connections whencreating a new connection. (Bug #49810)

Page 411: MySQL Workbench

Changes in Release 5.2

403

• When exporting a model to a single file using File, Export, Export as Single Page PDF or Export asSingle Page Postscript File, the table positions contained in the file were incorrect. (Bug #47384)

• Double-clicking any main tab, just below the main menu toolbar, caused MySQL Workbench to generatean exception. (Bug #50562)

• It was not possible to print EER Diagrams or schemata. The File, Print option was grayed out, andControl+P did not have any effect. (Bug #50528)

• MySQL Workbench reported the remote server as being down, in the Database Server Status sectionof the Administrator, even though the server was in fact running, and queries could be successfully runagainst the database using MySQL Workbench. (Bug #50453)

• When performing a data dump in the Administrator, the operation failed with an exit code 7.

MySQL Workbench has been changed so that it will generate an error if the mysqldump executablecannot be found. (Bug #50184)

• On the General tab of the configuration file editor, if a value was set for Temp directory, and thechanges applied, the value set was not displayed in the preview, implying it would not be set in theserver configuration file. (Bug #49423)

• In the Administrator, when an attempt was made to import multiple tables from the same project folder,MySQL Workbench only imported the first table and then stopped, reporting the import process asfinished. (Bug #49217)

• In the Columns tab of the Table Editor, attempting to change the column data type using the list causedMySQL Workbench to crash. (Bug #50546, Bug #50598, Bug #50527)

• When the menu item File, Page Setup was selected from the main menu, MySQL Workbench crashed.(Bug #50315)

• When a MySQL Workbench unhandled exception occurred and the exception dialog was displayed,if the user clicked Quit, and there were unsaved changes, a new dialog was displayed, warning ofunsaved changes. If Cancel was clicked on this dialog, MySQL Workbench would exit, which was notthe expected behavior because changes would then be lost. If Yes was clicked on this dialog, to savechanges, MySQL Workbench crashed. Overall, the behavior of the dialogs was confusing.

A new error dialog has been introduced that changes the handling. It presents the user options to go tothe bug report page, copy debug information to the clipboard and to close the dialog. (Bug #49304)

• Client-side sorting always sorted on an alpha basis, regardless of data type. This meant numeric valueswere not sorted into the order expected. (Bug #50158)

Changes in MySQL Workbench 5.2.14 (21 January 2010)

This section documents all changes and bug fixes applied since the release of 5.2.13.

Bugs Fixed

• In the Physical Schemata section of the MySQL Model tab, the tables were not displayed in alphabeticorder. (Bug #47143)

• In the SQL Editor, the Alter Table dialog created incorrect DDL for changes to the partitioning. (Bug#49055)

• If a multiline configuration option in the MySQL server configuration file was removed using theconfiguration editor of the Administrator tab, MySQL Workbench generated an error. (Bug #50470)

Page 412: MySQL Workbench

Changes in Release 5.2

404

Changes in MySQL Workbench 5.2.13 (Not released)

This section documents all changes and bug fixes applied since the release of 5.2.12.

Bugs Fixed

• If the server configuration file contained more than one entry for replicate-do-db, the configurationeditor on the Admin tab displayed only the second entry, rather than both. (Bug #49299)

• In the SQL Editor, if a routine was edited, and the changes applied, the changes were automaticallyreverted if the apply failed. This meant that any changes the user had made had to be entered again.(Bug #49790)

• Invalid values were written to the MySQL server configuration file by the configuration editor. MySQLWorkbench also added new entries to the configuration file, rather than update the existing entries. As aresult of the this the server failed to start. (Bug #49420)

• In the SQL Editor, if an object was created or renamed, that change was not reflected in the userinterface. This change fixes the problem for Linux and Mac OS X. (Bug #49454)

References: See also Bug #50424.

• When building MySQL Workbench 5.2.11 from source on CentOS 5.4, this error occurred:

python_context.cpp:388: error: invalid conversion from 'const char*' to 'char*'python_context.cpp:388: error: initializing argument 1 of 'PyObject*PyImport_ImportModule(char*)'make[4]: *** [python_context.lo] Error 1make[4]: Leaving directory `/home/install/mysql-workbench-oss-5.2.11/library/grt/src'make[3]: *** [all-recursive] Error 1make[3]: Leaving directory `/home/install/mysql-workbench-oss-5.2.11/library/grt'make[2]: *** [all-recursive] Error 1make[2]: Leaving directory `/home/install/mysql-workbench-oss-5.2.11/library'make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/home/install/mysql-workbench-oss-5.2.11'make: *** [all] Error 2

Note, from MySQL Workbench 5.2.13, binary and source packages for CentOS 5.4 will be available.Due to the dependence of MySQL Workbench on certain packages that are older in CentOS 5.4 than inother operating systems, MySQL Workbench has some minor features, such as tooltips, disabled. (Bug#50360)

• Selecting the Help, Check for Updates menu item opened the web browser and displayed an error:

Not Found

The requested URL /version-check.php was not found on this server.Apache Server at wb.mysql.com Port 80

(Bug #50415)

• In the configuration editor in the Admin tab, the lists for displaying units, such as for the Sort buffer sizeoption, did not show 'G', which represents Gigabytes. This bug was fixed in 5.2.10.

It was subsequently decided to standardize all units around uppercase characters. In particular the 'k'was changed to 'K'. This change was made in version 5.2.13. (Bug #49013)

Changes in MySQL Workbench 5.2.12 (Not released)

This section documents all changes and bug fixes applied since the release of 5.2.11.

Page 413: MySQL Workbench

Changes in Release 5.2

405

Functionality Added or Changed

• In the SQL Editor, if a table was edited with the Edit Data facility, and table values changed, no warningwas given if an attempt was made to close the tab without having first applied changes using the applybutton.

MySQL Workbench has been changed so that if the user attempts to close a live editing tab, withouthaving applied any changes made, a warning dialog is displayed. (Bug #49925)

• Undo operations are no longer tracked in the editors that work with live databases, such as table editorswithin the SQL Editor. (Bug #49284)

• MySQL Workbench has been changed to permit a connection to be created where the password doesnot have to be stored. In this case, MySQL Workbench prompts the user to enter the correct passwordwhen the connection is established. (Bug #49409)

Bugs Fixed

• Security Fix: The password for the connected MySQL Server was exposed by the SQL Administrator inMySQL Workbench. The password was displayed in plain text form in the Startup Message Log on theStartup tab of the Admin page. (Bug #43287)

• In the SQL Editor, when a schema was dropped, it was still displayed in the Overview tab and in theschemata explorer of the side panel. Further, MySQL Workbench did not provide any confirmation thatthe schema had been dropped successfully or otherwise. (Bug #49282)

• SSH Tunnels opened by MySQL Workbench were never closed. SSH Tunnels created when clickingTest Connection in the Manage DB Connections dialog, were not closed. This was also the case whenthe SQL Editor and Server Administration tabs were closed. (Bug #49411)

• In SQL Editor, SELECT statements that called functions, for example SELECT md5('abcd'), did notgive the expected result. (Bug #50248)

• In the Table Editor, the list for selecting the table engine type contained a reference to calpont. Thisshould now be infinidb. (Bug #50159)

• In the Create a new server instance wizard, if the check box Enable SSH login based administrationwas cleared, the wizard still prompted the user to enter an SSH password when the Next button wasclicked. (Bug #49226)

• The Manage DB Connections dialog did not prevent duplicate connection names or an empty string asa valid connection name. (Bug #49150)

• When performing a Synchronize Model operation, all foreign key relationships in the EER diagram thathad the setting draw split were redrawn as fully visible. (Bug #47767)

• In Mac OS X, the context-sensitive menu was missing from the live editing tab of the SQL Editor. Right-clicking in the editing tab simply displayed a Mac OS X menu, rather than the context-sensitive menu toenable actions such as copying, deletion and setting selections to NULL. (Bug #50114)

• If a database was reversed engineered from a source, and a table renamed, then although this changewas detected by MySQL Workbench, no DDL code was generated if an attempt was then made tosynchronize this change with the source. (Bug #49313)

• The toolbar buttons on the Home screen did not reflect the order of the action items in the Workspace.The Open Server Profile button and Open DB Connection Manager buttons needed to exchangepositions. (Bug #49149)

Page 414: MySQL Workbench

Changes in Release 5.2

406

• In the Logs tab of the Administrator, the Oldest and Newest buttons appeared to have reversedfunctionality. Oldest displayed the most recent timestamps and Newest displayed the oldest. (Bug#49065)

• In the Manage DB Connections dialog, many textfield labels appeared truncated. (Bug #49052, Bug#49378)

• When running MySQL Workbench from the command line, it could not open model files where the pathcontained a space. (Bug #46297)

• Lower panels such as the Table Editor remained open, even when the user returned to the Homescreen. (Bug #49926)

• In the Partitioning tab of the Alter Schema dialog, it was not possible to create a single partition. If apartition count of 1 was specified this was actually set to 2 in the generated DDL. (Bug #48114)

• Custom Python modules failed to load and were not displayed in the MySQL Workbench Plugins menu.

In MySQL Workbench 5.2 the syntax used has changed from @wbplugin to @ModuleInfo.Plugin.(Bug #50108)

• On the Model page, if some text was entered into a note in Model Notes, and then the model was savedand closed, on reloading the note would be empty.

This also happened for a script added in SQL Scripts. After the model was saved and reloaded, thescript would be empty. (Bug #50108)

• In the Manage DB Connections dialog, when attempting to create a Standard TCP/IP over SSHconnection, errors occurred when testing the connection in the case where a key file had been specified.If the path to the key file was quoted the error was:

Cannot open SSH Tunnel: ERROR Invalid request

If the same path was not quoted the error generated was:

Could not connect SSH tunnel: ERROR [Errno 22] invalid mode ('r') or filename:'D:\\Documents and Settings\\tf221715\\.ssh\\id_dsa'

It should be noted that currently only key files using the OpenSSH format are supported. (Bug #49812)

• In the Partitioning tab of the alter table dialog it was possible to enter a number greater than 10 into thePartition Count textfield. However, when these changes were applied the DDL generated substituted anyvalue entered that was greater than 10 with the value 2. (Bug #49380)

• The Alter Schema dialog in the SQL Editor permitted the schema name to be changed using the Nametextfield, even though doing this is not supported at the server level. (Bug #49281)

• In the SQL Editor if an EDIT table operation was being carried out, it appeared that data in the tablewas not updated, and also a row already inserted would be erroneously deleted when attempting to adda new row of data, when changes were applied.

MySQL Workbench has been changed so that if an error occurs during changes being applied, an errordialog is displayed showing any errors that occurred. Also, the status text is now updated to say “ApplyFailed”, rather than “Changes Applied”. (Bug #49179)

• Various errors occurred when attempting to modify the server configuration using the Configuration tabof the Administrator:

Unhandled exception: global name 'tempfile' is not defined

Page 415: MySQL Workbench

Changes in Release 5.2

407

Unhandled exception: [Errno 22] Invalid argument:'C:\\users\\tax\\appdata\\local\\temp\\tmpo47ttn'

Also, if the Logs tab was selected to view the server log files, this error occurred:

Unhandled exception: Error executing 'Select @ @log_output': Unknown system variable 'log_output'

(Bug #48906)

• Clicking the Test Connection button in the Manage DB Connections dialog caused MySQL Workbenchto lock up. The error generated on the console was:

18743 INFO Connecting to SSH server at 127.0.0.1:22...Unhandled exception in thread started by <bound method Tunnel._threadloop of<__main__.Tunnel instance at 0x9acea8>>

This happened for the connection method Standard TCP/IP over SSH. (Bug #49419)

• The script code generated from a model for routines did not quote schema names in USE statements.(Bug #50051)

• In the SQL Editor, when using the Query, Export Results... menu item, the file extension was omittedwhen selection of an existing output file was made. (Bug #49870)

• Two SSH tunnels were opened for a single connection to an SSH server. The user was also promptedfor a password when a new connection was established, even when the existing tunnel was reused.(Bug #49412)

• In the Server Status section of the Admin page, the SYSTEM graphic showed CPU usage at 50%,while the corresponding text label showed CPU usage at 0%. The graphic and label remained out ofsynchronization for around 15 seconds. (Bug #49212)

• The ID for a connection was displayed in the Connections tab of the Admin page, even after thecorresponding administration session had been closed. (Bug #48989)

• The Connections list in the Manage Server Instances dialog did not display the user name for socketand pipe connections. For example it displayed Localhost - @:0 <Local Socket/Pipe>, ratherthan Localhost - root@:0 <Local Socket/Pipe>. (Bug #48969)

• In the SQL Editor, if a Stored Procedure was executed and then immediately executed again, this errorwas generated:

Error code 2014 Commands out of sync; you can't run this command now

This problem only affected MySQL Workbench running on the Mac OS X platform. (Bug #49553)

• After selecting Edit Table Data from the Home screen, and launching the Edit Table Data wizard,MySQL Workbench crashed if a connection was selected and then the Next button clicked. (Bug#49864)

• Right-clicking a Routine Group and then selecting Copy SQL to Clipboard did not work. No code wascopied to the clipboard. (Bug #49440)

Page 416: MySQL Workbench

Changes in Release 5.2

408

• Opening a model file, closing it and quickly reopening it caused MySQL Workbench to hang. (Bug#49428)

• In the SQL Editor, if an item in the History tab was right-clicked, and the menu option Append selecteditems to SQL script selected, MySQL Workbench generated an unhandled exception:

glibmm-ERROR **: unhandled exception (type std::exception) in signal handler:what: vector::_M_range_check

(Bug #49245)

• In the Forward Engineer an ALTER Script wizard, the textfields and associated buttons for selectinginput and output files were not positioned correctly within the window, when the selected file name waslong. Although the files could be selected when the wizard was first launched, if the wizard was launchedsubsequently, the text fields would be filled with the previously selected file names, causing the textfieldsand Browse buttons to be located beyond the borders of the window.

A similar problem also affected the Forward Engineer SQL Script wizard. (Bug #48222)

• MySQL Workbench generated an unhandled exception when trying to add a new column using theAlter Table facility in the SQL Editor. After the VARCHAR(45) column was added, without selecting anycolumn check boxes, the exception occurred when the Apply button was clicked. (Bug #49364)

Changes in MySQL Workbench 5.2.11 (18 December 2009)

This section documents all changes and bug fixes applied since the release of 5.2.10.

Functionality Added or Changed

• MySQL Workbench had confusing and erroneous behavior when attempting to handle multiple modeltabs. It has now been changed so that if a model is currently loaded, and a new model or saved modelneeds to be loaded, the current model will be closed first before then opening the new model. (Bug#49422)

• In the configuration editor, it was not possible to find, and therefore set, the configuration variable “old”.

This has now been added to the General tab in the configuration editor of the Admin tab. (Bug #49039)

• It was impossible to use a function call as a field value in an editable result set, such as for a resultset in the Query Editor or in the Inserts tab in the Table Editor. This was because MySQL Workbenchautomatically escaped string parameters passed to the function call. For example, if an attempt wasmade to enter into a field a function such as md5('fred'), MySQL Workbench would generate theSQL code md5(\'fred\').

MySQL Workbench now makes it possible to enter a function, or any other expression, into a field usingthe \func prefix. For example, \func md5('fred') can be entered. MySQL Workbench will nowensure that the string 'fred' is not escaped. See Live Editing Tabsheets. (Bug #38600)

Bugs Fixed

• Security Fix: When using the Data Dump facility in the Admin screen, the full mysqldump command,including the password used, was written to the logs. (Bug #49294)

• The AUTHORS file in the MySQL Workbench distribution was empty. (Bug #49341)

• In the Create new server instance wizard, on the MySQL Config File page, clicking the Check pathbutton generated an exception. (Bug #49228)

Page 417: MySQL Workbench

Changes in Release 5.2

409

• If a connection failed MySQL Workbench reconnected silently. This caused problems with transactions.If changes were made to a table, before a COMMIT, and the connection lost, MySQL Workbench wouldreconnect silently and enable the user to COMMIT. However, it did not warn that this COMMIT was on anew connection, and that the COMMIT would have no effect. (Bug #49461)

• In the SQL Editor the SQL Statements area could only display ten lines of code and was not resizeable.(Bug #49788)

• The live data editor of the SQL Editor, which was launched by double-clicking a table in the Overviewtab, did not behave correctly. If a column value was changed, and the cursor remained in the editedcell, then if the Apply made changes to data source toolbar button was clicked, the contents of the cellreverted to its value prior to editing. However, other cell values that had been edited were correctlysaved. (Bug #49301)

• When importing data using the Data Dump tab of the Admin screen, MySQL Workbench did not notifythe user of failed imports because it could not detect failed imports. (Bug #49297)

• When a export was performed using the Data Dump tab of the Admin screen, and the export failed, theresulting SQL file was not deleted. (Bug #49296)

• When a schema containing tables with foreign key indexes was synchronized with a live server, MySQLWorkbench attempted to erroneously drop and recreate at least one of the foreign key indexes. (Bug#47766)

• In the Overview tab of the SQL Editor, the toolbar buttons to add and drop a schema did not function.Clicking the buttons appeared to have no effect. (Bug #49240)

• When using the Create a new server instance wizard, the panel used to enter the SSH password washidden by the wizard. (Bug #49416)

• In the Overview tab of the SQL Editor the drop database button on the toolbar did not work correctly.If pressed the dialog presented did not contain the name of the current database in its message, andgenerated text such as:

Do you want to drop database `` from DB server ...

Note the empty string where the database name should have been. Further, the text on the dialog buttondrop was also missing the database name:

DROP ``

(Bug #49330)

• In the Document Properties dialog the created date and last changed date values were reversed. (Bug#48104)

• In the Server Status section of the Admin screen, the values for CPU status appeared to be erroneouslymultiplied by 100, and the Memory status appeared to be continually 0. (Bug #48994)

• In the Overview tab of SQL Editor, the toolbar buttons representing large icons, small icons, list, add,and delete did not function correctly. (Bug #49239)

• In an EER diagram, if relationship links were laid out as desired, and then a synchronization with the liveserver carried out, the relationship links were repositioned by MySQL Workbench. (Bug #47234)

• On the Admin screen the labels for the monitoring graphs were difficult to read. Further, the value forTraffic was sometimes displayed as a negative number. (Bug #49211)

Page 418: MySQL Workbench

Changes in Release 5.2

410

• In the Home screen Workspace, in the central panels listing connections, models and server instances,the items in the panels appeared to be rendered as links. However, clicking these “links” had no effect,and the items could only be loaded by double-clicking.

MySQL Workbench has been changed to remove the link effect, and these items can only be loaded bydouble-clicking. (Bug #49623)

• If the Home screen was closed and then an attempt made to reopen it from the View, Home main menuoption, MySQL Workbench crashed. (Bug #49388)

• When using the Reverse Engineer SQL Script to import the Sakila script file, sakila-data.sql,MySQL Workbench occasionally crashed. (Bug #49381)

• In the SQL Editor, when editing live table data, there was no right-click menu item to delete a row. (Bug#49300)

• In the SQL Editor, using the Alter Routine wizard to generate a script to modify an existing routine inthe live database results in errors, due to incorrect script code being emitted. For example, the statementDELIMITER $$ was missing from the start of the script. (Bug #49289)

• When using the Data Dump facility on the Admin screen, the export process appeared to hang whenexporting with the Export to Backup Project Folder radio button selected. (Bug #49113)

• In the General tab of the configuration editor in the Admin screen, the option Default table typeprovided an incomplete, and incorrectly capitalized, list of storage engines/table types. (Bug #49010)

• In the Configuration tab of the Admin screen, any changes made and applied were not reflected in theconfiguration file of a local MySQL Server installation. (Bug #49008)

• The path to the an external mysqldump tool set in the MySQL tab of the Preferences dialog wasignored by MySQL Workbench. This prevented the Data Dump facility in the Admin screen from workingcorrectly because the required tool could not be found. (Bug #49319)

• In an EER diagram, if the model was synchronized with a live database, any foreign key relationshiplines that were set to hidden became visible. (Bug #49631)

• The server health graphs Connection Usage and Traffic, in the Server Status panel of Admin tab,appeared to indicate the server was operating at 100% capacity, even when this was not the case.

MySQL Workbench has been changed to use variable scaling, rather than linear scaling, for thesegraphs. (Bug #49214)

• In the Schemata Palette of the SQL Editor the default schema selector did not work if the schema namecontained a '.' character. (Bug #49373)

• In the Advanced tab of the configuration editor, the option Delay key write had a file selector buttonassociated with it. This should have been a list offering the values ON, OFF, ALL. (Bug #49424)

• In the History tab of the SQL Editor, it was possible to simultaneously select multiple entries in the Timepanel. However, this did not seem to serve any useful purpose as the content of the SQL column onlydisplayed the code for a single entry. (Bug #49375)

• When using the SQL Snippets palette, right-clicking a snippet, and then selecting the menu item Inserttext into SQL Area, replaced all text in the SQL Statements area. This happened after another snippethad previously been inserted because the default state was to leave all code in the SQL Statementsarea selected. (Bug #49370)

• The Configuration tab on the Admin screen had a text label “Edit my.cnf File”. This text was notappropriate as on Windows the configuration file is called my.ini. (Bug #49237)

Page 419: MySQL Workbench

Changes in Release 5.2

411

• MySQL Workbench did not have the ability to toggle Autocommit mode, or a facility to explicitly start atransaction, in the SQL Editor. This was in contrast to Query Browser, which did support such facilities.(Bug #49384)

• When MySQL Workbench silently reconnected to a server after a communication failure, it failed toreinitialize the connection correctly. As a result of this failure Autocommit was silently enabled. If auser was working with transactional tables, the commit and rollback toolbar buttons appeared to work,although they had no effect. (Bug #49462)

• In the configuration editor, on the Admin tab, the operation of the Apply and Cancel buttons did notwork correctly. If an option was selected, and then Cancel selected in the view changes dialog, andthen Apply clicked again, the selected option was incorrectly listed twice in the configuration file. (Bug#49236)

• Even though the server had been stopped, the Server Status graphical panel displayed values foractive connections, traffic and key efficiency, giving the impression that the server was still active. (Bug#49225)

• In the Log Files tab of the configuration editor, selected from the Admin tab, the option Write Logs todid not work correctly. If either the Files or Tables options were selected from the option list, the MySQLServer would not subsequently start. This was because the options should have been File and Table.(Bug #49123)

• When using the Create Table wizard in the SQL Editor, the resulting dialog contained certain optionsthat could not be deselected once selected. For example, the Merge Method option featured a list withthree options: Prevent Inserts, First Table, Last Table. Note that once one of these options was selected,there was no way to clear this selection, as there was no facility to select anything other than one ofthese three options. (Bug #49048)

• When an attempt was made to load the sakila.sql script file in the SQL Scripts section of the Modeltab, MySQL Workbench crashed with this error:

glibmm-ERROR **: unhandled exception (type std::exception) in signal handler:what: File '/home/kolbe/Downloads/sakila-db/sakila-data.sql' contains invalid UTF-8data.

(Bug #49242)

• In the General tab of the configuration editor, changing the data directory using the file chooser controlled to an invalid directory being introduced into the MySQL configuration file. This prevented the MySQLServer from starting. (Bug #49036)

• After synchronizing a model with a live database, and saving the resulting modified model, MySQLWorkbench crashed. On restarting and attempting to reopen the model file, MySQL Workbenchgenerated this error:

Error unserializing GRT data inserting null value to not null list

(Bug #47518)

• If a relationship link was selected in the EER Diagram view, and the menu item Plugins, Objects, CopySQL to Clipboard was selected, an error was generated.

Note that in version 5.2.11 this menu option is correctly disabled for these objects. (Bug #39556)

Changes in MySQL Workbench 5.2.10 (01 December 2009)

This section documents all changes and bug fixes applied since the release of 5.2.9.

Page 420: MySQL Workbench

Changes in Release 5.2

412

Functionality Added or Changed

• The Help, Workbench Product Page menu item launched the default web browser, but displayed anoutdated product page. This was due to a web server configuration issue. MySQL Workbench nowdisplays the correct, up-to-date product page. (Bug #49066)

• MySQL Workbench now has the command line option --version, which is used to display the versionof the application, when launching the application from the command line. (Bug #49136)

Bugs Fixed

• In the configuration editor in the Admin tab, the lists for displaying units, such as for the Sort buffer sizeoption, did not show 'G', which represents Gigabytes. This bug was fixed in 5.2.10.

It was subsequently decided to standardize all units around uppercase characters. In particular the 'k'was changed to 'K'. This change was made in version 5.2.13. (Bug #49013)

• In the configuration editor, in the Admin tab, the Discard button simply unchecked all options, rather thanjust those that had been checked during the current editing session. This made the button appear tohave a “clear all” function, rather than the expected “revert changes” function. (Bug #49234)

• When using Alter Table in the SQL Editor, if a table name was changed, and the Apply button clicked,the Apply Object Changes wizard was launched. The Review changes page indicated that the scriptthat would be applied would incorrectly create a new table as a duplicate of the table being renamed,rather than use ALTER to rename the table. (Bug #49275)

• A MySQL configuration file caused MySQL Workbench to crash, when an attempt was made to view it inthe configuration editor of the Admin tab. The error generated was:

Unhandled exception: 'bool' object has no attribute 'strip'

(Bug #49060, Bug #49602)

• When using Alter Table in the SQL Editor, if a column name was changed, and the Apply button clicked,the Apply Object Changes wizard was launched. The Review changes page indicated that the scriptthat would be applied would drop the altered column then add a new column with the new name. Thisled to column data being lost because the script should instead have used CHANGE COLUMN, to changethe name of the column. (Bug #49286)

• In the SQL Editor, the database explorer of the Schemata palette in the side panel did not work correctly.Incorrect behavior included random collapsing of expanded databases and occasional crashing. (Bug#48981)

• In the SQL Editor, two buttons on the toolbar had no tooltips. These were the green check or tick mark,and the red back arrow buttons. Further, they did not seem to become enabled or disabled according tothe context, making it difficult to determine their intended function. (Bug #49059)

• On the Admin screen, the server configuration option Key buffer, was located under the General tab,rather than the MyISAM Parameters tab, even though it was a MyISAM-only option. (Bug #49017)

• When using the Forward Engineer SQL CREATE Script wizard, if the check box Omit SchemaQualifier in Object Names was selected, the script code for views was omitted. (Bug #49153)

• MySQL Workbench did not handle signed and unsigned integers correctly. For example, if performinga synchronization between a model and a live database where the only difference was a column wasdeclared to be of type INTEGER in one case and UNSIGNED INTEGER in the other, the difference wouldnot be detected and the ALTER script would imply the databases were the same. (Bug #49063)

Page 421: MySQL Workbench

Changes in Release 5.2

413

• In the Manage Server Instances dialog, if the Server Instances list pane was empty, then on creating anew Server Instance, it was not possible to change the instance's name. The instance had to be created,the dialog closed. On reopening the dialog, the instance could be renamed. (Bug #48967)

• The Generate Catalog Diff Report feature did not permit the comparison of imported scripts becauseselecting the radio button for this option had no effect. (Bug #47230)

• If a collation was changed for a table in the Table Editor, there was no facility to then set this back to theschema default.

A new entry has been now been added to the collation selection list: Schema Default. (Bug #46513)

• When using the data modeler, MySQL Workbench extended vertically to the maximum size of thescreen, overlapping the dock, and thereby making it impossible to use. (Bug #48976)

• In the Administrative Roles tab of Server Access Management, selection of Roles did not workcorrectly. For example, selecting the DBA check box, and then deselecting it, caused all roles to bedeselected. Further, using the Revert button resulted in the selected user disappearing from the UserAccounts panel. (Bug #49071)

• On the MySQL Config File page of the New Server Profile wizard, clicking Check section generated anexception if there were options in the MySQL configuration file that did not have values assigned:

Check if mysqld section exists in /tmp/my.cnf** Message: function call errorTraceback (most recent call last): File "/usr/lib/mysql-workbench/modules/wb_admin_grt.py", line 292, intestInstanceSettingByName parser.read([config_file]) File "/usr/lib/python2.5/ConfigParser.py", line 267, in read self._read(fp, filename) File "/usr/lib/python2.5/ConfigParser.py", line 490, in _read raise eConfigParser.ParsingError: File contains parsing errors: /tmp/my.cnf [line 2]: 'log-bin\n'

glibmm-ERROR **: unhandled exception (type std::exception) in signal handler:what: error calling WbAdmin.testInstanceSettingByName: see output for details

(Bug #49057, Bug #47954)

• When a model containing stored routines was forward engineered to a script, the script contained anerroneous additional delimiter after each stored routine. This resulted in a “No query specified” errorwhen an attempt was made to run the script on a server. (Bug #39929)

Changes in MySQL Workbench 5.2.9 (Internal release only)

Internal release. This section documents all changes and bug fixes applied since the release of 5.2.8.

Functionality Added or Changed

• If, while editing data in the Inserts Editor, the ESC key was accidentally pressed, the Inserts Editor wouldclose without warning and all data entered to that point would be lost.

The improved Inserts Editor does not display this characteristic. Pressing the ESC key will have noeffect. (Bug #48452)

Bugs Fixed

Page 422: MySQL Workbench

Changes in Release 5.2

414

• In the EER Diagram view, the Toggle Grid and Align Objects to Grid toolbar buttons were not renderedcorrectly when in the selected state. (Bug #48822)

• The Workbench Configuration editor interface contained a backtick character rather than a singleapostrophe. (Bug #49014)

• The Inserts Editor did not display columns of type ENUM. (Bug #48288)

• Clicking the Action Item Manage Security on the Home screen resulted in MySQL Workbench crashing.(Bug #48990)

• On the Filter Objects page of the Forward Engineer SQL Script wizard, clicking Show Filter, selectingmultiple objects from the left panel, and then clicking >, would result in only the first of the selectedobjects being moved to the right hand panel. (Bug #48116)

• In the Overview tab of the SQL Editor, representing a “live” view of the database currently connected to,if an attempt was made to edit a view, the resulting script generated unnecessary, and in fact dangerous,DROP TABLE statements. This had the potential side-effect that a table that coincidentally had the samename as the view, would be dropped with ensuing data loss. (Bug #49041)

• Running the Forward Engineer an ALTER Script wizard resulted in an ALTER script that dictatedchanges were required to tables, even in the case where no such changes were necessary. (Bug#47063)

• When using the Forward Engineer SQL Script wizard, the script generated for a model containingmultiple schemata, only included the CREATE SCHEMA statement for the first schema. (Bug #47202)

• In the Advanced tab of the Admin screen, the check box SQL Mode had an erroneous file chooserbutton associated with it. The button should not have been there. (Bug #49012)

• After creating a new Server Instance from the Home screen, then clicking the Logs tab in the Adminscreen, this exception was generated:

Unhandled Exception: Error executing 'SELECT @@log_output':Unknown system variable 'log_output';

(Bug #49004)

• In the Configuration tab of the Server Administrator screen, if log file configuration changes wereapplied, MySQL Workbench hung if the password request dialog was cancelled. (Bug #49037)

• Using UTF-8 accented characters in the Stored Routine DDL editor caused the DDL parser to raise asyntax error and refuse to save the routine. (Bug #47730)

• Attempting to use Database, Generate Catalog Diff Report resulted in a Segmentation Fault. (Bug#46810)

• MySQL Workbench crashed when the Import/Export Server Data Action Item on the Home screen wasclicked. (Bug #49064)

• Clicking the Action Item, Manage Security, on the Home screen generated this exception:

Traceback (most recent call last): File "C:\Program Files\MySQL\MySQL Workbench 5.2 OSS/modules\wb_admin_grt.py", line199, in openSecurityManager tab.wait_server_check(4) File "C:\Program Files\MySQL\MySQL Workbench 5.2 OSS/modules\wb_admin_grt.py", line 95,in wait_server_check while tab.configuration.last_is_running_check is None and time.time() - t < timeout:NameError: global name 'tab' is not defined

Page 423: MySQL Workbench

Changes in Release 5.2

415

Further, if this Action Item was clicked again then MySQL Workbench crashed. (Bug #49061)

• The Forward Engineer SQL Script failed to generate SQL code when the check box Generate INSERTStatements for Tables was selected, and the tables contained rows. (Bug #49046)

• MySQL Workbench did not parse the following entry in the my.ini file correctly:

default-storage-engine=INNODB

This resulted in the default storage engine not being detected correctly by MySQL Workbench, althoughthis entry was correctly recognized by the MySQL server. However, MySQL Workbench did parse thefollowing entry correctly, due to the correct capitalization being used:

default-storage-engine=InnoDB

(Bug #49007)

• The Forward Engineer SQL Script wizard did not generate correct delimiter syntax for routines. Forexample, it generated this code:

DELIMITER ////

CREATE PROCEDURE `sakila`.`film_not_in_stock`(IN p_film_id INT, IN p_store_id INT, OUTp_film_count INT)

READS SQL DATABEGIN SELECT inventory_id FROM inventory WHERE film_id = p_film_id AND store_id = p_store_id AND NOT inventory_in_stock(inventory_id); SELECT FOUND_ROWS() INTO p_film_count;END ////

This resulted in errors when an attempt was made to run the generated script on MySQL Server. (Bug#46505)

• Working through the Synchronize Model with Database wizard did not result in the live database beingupdated. (Bug #47953)

• Any TEXT columns in the Table Editor, or TEXT columns in the SQL Editor results tabsheet, weredisplayed as BOOLEAN values, either 1 or 0. (Bug #48982)

• The Forward Engineer SQL Script wizard did not generate the export script. On the Review SQLScript page of the wizard, the review panel was blank. Further, clicking Copy to Clipboard generated thisexception:

Unknown Exception caught in c:\documents and settings\mysqldev\my documents\visualstudio 2008\projects\workbench52\backend\windows\wbprivate.wr\src\Wb.h at line 1085.

(Bug #47482)

• MySQL Workbench crashed on opening a model file. This appeared to be due to MySQL Workbenchcausing corruption in the model file. (Bug #48891)

Page 424: MySQL Workbench

Changes in Release 5.2

416

Changes in MySQL Workbench 5.2.8 (18 November 2009, Beta)

First Beta release of 5.2. This section documents all changes and bug fixes applied since the release of5.2.7.

Bugs Fixed

• In the Manage DB Connections dialog, the text fields Username, Password, and Default Schemaaccepted text, but as the text was being entered only the top half of the characters entered displayed.However, once the text had been submitted, the characters were displayed correctly. (Bug #45106)

• In the EER Diagram view, the auto-resizing of tables did not work correctly, tables were too small topermit all columns to be visible. (Bug #46806)

• When a table was edited in the EER Diagram view, and Control+S was pressed to save the model, themodel file was not saved. (Bug #48682)

• If an model object, such as a schema or table, was deleted or its creation was undone using the undofeature, while the object editor was open, a crash occurred if the editor was then subsequently closed.(Bug #48664)

• When using the Fedora 10 RPM installation packages on Fedora 11, opening a database connectionproduced this error:

Cannot Connect to Database ServerConnection 'antonia' could not be established: Database driver: Failed to open library'/usr/lib/mysql-workbench/mysqlcppconn.so'. Check settings.

The MySQL Workbench libraries were installed in /usr/lib64/, not /usr/lib/. (Bug #46428)

• The View text editor was overly aggressive in trimming excess whitespace from View definitions. If therewas some hesitation after the user entered one or more spaces, the editor would trim whitespace back tothe last non-space character entered. (Bug #46894)

• Once a default value had been set for a column in the Table Editor, it was not possible to remove it. (Bug#47085)

• When running MySQL Workbench, this error occurred when an attempt was made to change theWindows screen resolution:

cairo error: out of memory

(Bug #48520)

• MySQL Workbench did not start correctly. At startup it generated this error:

Microsoft Visual C++ Runtime Library

Runtime Error!

Program C:\Pro...

This application has requested the Runtime to terminate it in an unusual way.Please contact the application's support team for more information.

(Bug #48389)

• Printing of an EER Diagram did not work correctly if a table vertically spanned multiple pages. In thiscase pages would be printed up to and including the page that contained the first part of the table thatspanned multiple pages, but the pages containing the remaining parts of the table would not be printed.

Page 425: MySQL Workbench

Changes in Release 5.2

417

This problem typically occurred when a table had more fields than could comfortably fit on a single page.(Bug #33919)

Changes in MySQL Workbench 5.2.7 (Internal release only)

This section documents all changes and bug fixes applied since the release of 5.2.6.

Functionality Added or Changed

• In the Administrator tab of MySQL Workbench the Data Dump (Export/Import Data) feature now usesthe --comments parameter when executing an import or export operation. (Bug #23002)

Bugs Fixed

• In the Reverse Engineer Database wizard it was not possible to select only one table to reverseengineer, and then proceed to the next step. (Bug #45881)

• In the Inserts tab of the Table Editor, if a string that contained spaces was added as an insert, the stringwas truncated to the text before the first space. (Bug #46624)

• In the GRT shell the help command, which is equivalent to ?, crashed when no arguments werespecified. (Bug #47503)

• When a model was loaded and an EER Diagram opened, the model navigator did not display the modelcorrectly. (Bug #46970)

• The Use compression protocol option was not working correctly when set in the Manage DBConnections wizard.

When the checbox Use compression protocol was selected in the Advanced tab of the Manage DBConnections wizard, this error was generated when the connection was tested:

No bool value passed for CLIENT_COMPRESS

The same error occurred even if the Use compression protocol check box was subsequently cleared.(Bug #48202)

• When an attempt was made to add a database connection, this error was generated:

Test connect failedCouldn't load library libmysqlclient_r.so: libmysqlclient_r.so: cannot open shared objectfile: No such file or directory

This only happened on Linux. (Bug #47238, Bug #48507)

• In the Columns tab of the Table Editor, the tooltip for the AI column did not work. If the cursor wasplaced over the column no tooltip text was displayed. (Bug #48129)

• If an EER Diagram tab was closed, it was not possible to reopen it by clicking its icon on the modelpage. (Bug #47545)

• In the Inserts tab of the Table Editor, values entered for a BIT column were not saved. If values wereentered and then the changes applied, the values in the BIT column disappeared. (Bug #47100)

• In the Table Editor, when trying to modify a column default value, errors occurred.

• On a TIMESTAMP column it was not possible to enter a valid value of the format yyyy-mm-ddhh:mm:ss. This caused an error if forward engineering was attempted.

• A NULL default value for a column could not be deleted.

Page 426: MySQL Workbench

Changes in Release 5.2

418

(Bug #46878)

• On Ubuntu Linux, MySQL Workbench did not warn if a new model was to be saved as a file that alreadyexisted on the drive. (Bug #48345)

• When editing a stored routine or trigger in the Table Editor, the cursor would relocate to the top of theediting window if a key was not pressed for a few seconds.

Note

On Windows this issue was fixed in 5.1.18. On Mac OS X this issue was fixed in5.2.4. On Linux this issue was fixed in 5.2.7.

(Bug #48156)

• Attempting to export the result of an SQL query to CSV using Query, Export Results... gave the error:

Failed to open template file: `/usr/share/mysql-workbench/modules/data/sqlide/CSV.tpl`

This occurred on a Fedora 11 AMD64 install, from RPM. The requested file was found in a differentdirectory, /usr/share/mysql-workbench/sqlide/. The error did not occur after the file was movedto the required location. (Bug #48156)

• In the Manage Server Instances wizard, MySQL Workbench crashed if the New button was clicked.(Bug #48347)

• The script generated by File, Export, Forward Engineer SQL CREATE Script dropped a schema if itexisted and then recreated it. This resulted in loss of existing data. (Bug #47468)

• In the Table Editor, the keyboard shortcuts such as Control+X, Control+V and Control+C, affected themain document, rather than being confined to within the Table Editor. For example, if Control+C wasused to copy a column, this erroneously resulted in a duplicate table being created in the main model.(Bug #42626)

• When running a plugin that called a function such as the following, the document's status was set to“unsaved”, and an asterisk was displayed in the title bar, as soon as the file selection dialog opened.This occurred even for a new document, or an unmodified document.

function rfstest(obj) local path path = Workbench:requestFileSave("Caption", "SQL Files (*.sql)|*.sql")end

(Bug #44813)

• Forward Engineer SQL CREATE Script generated schema qualifiers for Stored Procedure namesregardless of the setting of the Omit schemata qualifiers from output check box. This resulted in thegenerated script containing Stored Procedure names prefixed by the schema name. (Bug #43276)

• If a collation was set as the schema default, this was not correctly handled when the model wassynchronized with a live database.

If a collation was set as a schema default, and then the model forward engineered to a database, thecollation was correctly set. If however, the model was then synchronized with the live database, MySQLWorkbench attempted to alter the collations to utf8_general_ci. (Bug #38807)

Page 427: MySQL Workbench

Changes in Release 5.2

419

Changes in MySQL Workbench 5.2.6 (21 October 2009)

This section documents all changes and bug fixes applied since the release of 5.2.5.

Bugs Fixed

• After using the Forward Engineer to Database wizard, MySQL Workbench would crash if an attemptwas subsequently made to exit the application. (Bug #47276)

• If a foreign key relationship was altered to point to a column in a different table, the foreign key wasupdated correctly but the EER diagram was not redrawn to reflect the new relationship. (Bug #47807)

• When editing a trigger, the trigger editor would automatically insert a delimiter during a pause in typing,and also relocate the cursor. (Bug #45929)

Changes in MySQL Workbench 5.2.5 (Internal Release Only)

This section documents all changes and bug fixes applied since the release of 5.2.4.

Bugs Fixed

• The following exception was generated when closing the Relationship tab for an EER Diagram:

System.NullReferenceException: Referência de objeto não definida para uma instância deum objeto. em MySQL.GUI.Workbench.MainForm.mainDockPanel_ActiveDocumentClosing(Object sender,ActiveDocumentClosingEventArgs e) emWeifenLuo.WinFormsUI.Docking.DockPanel.OnActiveDocumentClosing(ActiveDocumentClosingEventArgs e) em WeifenLuo.WinFormsUI.Docking.DockPane.CloseContent(IDockContent content) em WeifenLuo.WinFormsUI.Docking.DockPane.CloseActiveContent() em WeifenLuo.WinFormsUI.Docking.VS2005DockPaneStrip.Close_Click(Object sender,EventArgs e) em System.Windows.Forms.Control.OnClick(EventArgs e) em System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32clicks) em System.Windows.Forms.Control.WndProc(Message& m) em System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) em System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) em System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam,IntPtr lparam)

(Bug #47958)

• When attempting to run MySQL Workbench, the splash screen appeared and then the applicationimmediately crashed, generating the “Send error report to Microsoft” dialog. On debugging it was foundthat MySQL Workbench was throwing a TypeLoadException:

Could not load type 'WeifenLuo.WinFormsUI.Docking.ActiveDocumentClosingEventArgs' fromassembly 'WeifenLuo.WinFormsUI.Docking, Version=2.2.3428.40956, Culture=neutral,PublicKeyToken=null'.

On inspection of the referenced assembly it was confirmed that there was no typeActiveDocumentClosingEventArgs defined. (Bug #47534, Bug #47480)

Changes in MySQL Workbench 5.2.4 (07 October 2009)

This section documents all changes and bug fixes applied since the release of 5.2.3.

Functionality Added or Changed

Page 428: MySQL Workbench

Changes in Release 5.2

420

• Some keyboard shortcuts have been changed.

On Microsoft Windows and Linux Control+Y is now used for Redo. Mac OS X continues to useCommand+Shift+Z as its default for Redo. For Synchronize Model, Control+Alt+Y is used on Windowsand Linux, and Command+Control+Y is used on Mac OS X. (Bug #46285)

Bugs Fixed

• In the Synchronize Model with Database dialog the text in the upper right area of the dialog did notwrap correctly, resulting in some text not being visible. (Bug #45455)

• When editing a stored routine or trigger in the Table Editor, the cursor would relocate to the top of theediting window if a key was not pressed for a few seconds.

Note

On Windows this issue was fixed in 5.1.18. On Mac OS X this issue was fixed in5.2.4. On Linux this issue was fixed in 5.2.7.

(Bug #48156)

• Clicking the Test Connection button in DB Connection Editor wizard did not appear to have any effect.(Bug #47083)

• If a new empty EER diagram was created, then Model, Relationship Notation, Connect to Columns wasselected, MySQL Workbench generated these messages:

** Message: item_activated: 0x28d5cf0 ->'plugin:wb.view.setRelationshipNotation:fromcolumn'** Message: unhandled message 4: wb.view.setRelationshipNotation finished in 0.00s

These messages were not generated if the EER diagram contained at least one table. (Bug #47565)

• On Mac OS X using cmd + backspace to delete a column in the table editor did not work. (Bug #46613)

• In the Query Editor, when an attempt was made to expand a schema and select a table, this exceptionwas generated:

************** Exception Text **************System.AccessViolationException: Attempted to read or write protected memory. This isoften an indication that other memory is corrupt. at MySQL.Grt.TreeModel.expand_node(NodeId node) at MySQL.Grt.GrtTreeModel.TreeViewExpanding(Object sender, TreeViewAdvEventArgs e) at System.EventHandler`1.Invoke(Object sender, TEventArgs e) at Aga.Controls.Tree.TreeViewAdv.OnExpanding(TreeNodeAdv node) at Aga.Controls.Tree.TreeViewAdv.SetIsExpanded(TreeNodeAdv node, Boolean value) at Aga.Controls.Tree.TreeViewAdv.SetIsExpanded(ExpandArgs eargs) at Aga.Controls.Tree.TreeViewAdv.SetIsExpanded(TreeNodeAdv node, Boolean value, BooleanignoreChildren)...

(Bug #47044)

• When a table was opened for editing in the Query Editor, the DECIMAL column values appeared in theresult set as integer values, disregarding precision and scale settings. The fractional part of the numberwas discarded. It was also not possible to add the fractional part of the number during editing. (Bug#47405)

• When a model was synchronized, this incorrect SQL was generated:

CREATE TABLE IF NOT EXISTS `synthescom`.`adx_clienti` (

Page 429: MySQL Workbench

Changes in Release 5.2

421

`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT ,

`citta` VARCHAR(100) NULL DEFAULT NULL ,

`provincia` VARCHAR(100) NULL DEFAULT NULL ,

PRIMARY KEY (`id`)

ENGINE = MyISAM

DEFAULT CHARACTER SET = utf8

COLLATE = utf8_general_ci;

Note that the closing parenthesis, which should have been located after the PRIMARY KEY statement, ismissing. Thats resulted in this error being generated:

ERROR: Error 1064: You have an error in your SQL syntax; check themanual that corresponds to your MySQL server version for the rightsyntax to use near 'ENGINE = MyISAM

DEFAULT CHARACTER SET = utf8

COLLATE = utf8_general_ci' at line 13

(Bug #47407)

• In the EER Diagram, Layer names were not rendered. This only happened with OpenGL rendering (onlyon Microsoft Windows). (Bug #47385)

• When the Query Database menu option was selected, the explorer on the right-hand side displayedTables, Views and Routines, but when the Routines folder was expanded the routines contained in themodel were missing. (Bug #47088)

• MySQL Workbench EER Diagram view did not permit the creation of a foreign key constraint on aprimary key. (Bug #39546)

Changes in MySQL Workbench 5.2.3 (15 September 2009)

This section documents all changes and bug fixes applied since the release of 5.2.2.

Functionality Added or Changed

• In the Inserts tab of the Table Editor, if a value was entered with quoting then any characters in thestring requiring escaping were not escaped. However, if the same string was entered without quotingthen the string would be escaped correctly by MySQL Workbench.

For 5.0 and 5.1 this is expected behavior. If a value is entered without leading and trailing quotationmarks, the Inserts Editor adds quoting and escapes characters that require it. However, if quoted textis entered, the Inserts Editor carries out no further checks because it assumes a correctly escaped andquoted sequence has been entered.

5.2 features a new Inserts Editor. In this case the user enters the string without quoting or escaping andthe Inserts Editor takes care of all quoting and escaping as required. (Bug #38906)

Bugs Fixed

• During Forward Engineering, clicking the Copy to Clipboard button generated code that contained anextra newline per line. (Bug #45579)

Page 430: MySQL Workbench

Changes in Release 5.2

422

• When a model containing invalid/broken foreign key definitions was loaded into MySQL Workbench, theerrors were detected and repaired.

However, when the model was saved and reloaded it contained changed data types. All INTEGERcolumns were changed to INTEGER(11). Further, some BOOLEAN columns were changed toBOOLEAN(1). (Bug #46467)

• In the Forward Engineer SQL CREATE script wizard, in the dialog asking for confirmation to overwritean existing file, clicking the Cancel button led to the wizard proceeding to the next step, while clicking theReplace button led to cancellation of the action. The functionality of the buttons appeared to be reversed.(Bug #47257)

• When a database with Stored Procedures was reverse-engineered into MySQL Workbench the StoredProcedures were not displayed in the Routine Editor, and so could not be edited. (Bug #45704)

• When adding inserts with a NULL value in a column, MySQL Workbench incorrectly added singlequotation marks to the NULL value.

Note

Note, when entering a NULL value right-click the button next to the value andselect Set selection to NULL, otherwise NULL will be interpreted as a stringliteral.

(Bug #47122)

• It was not possible to assign columns to indexes because the Column check boxes did not respond tomouse events. (Bug #45260)

• When a connection was selected in the DB Connection Editor it appeared to flicker a number of timesbefore MySQL Workbench crashed. (Bug #46065)

• MySQL Workbench generated a segmentation fault when clicking either the NN or AI check boxes onthe Columns tab of the Table Editor. (Bug #45075)

• MySQL Workbench crashed on launch on Mac OS X 10.6.0. (Bug #46953)

• If the Default Storage Engine was selected as MyISAM in the Model Options dialog, when a new tablewas created in the EER Diagram it was found to have a storage engine type of InnoDB. (Bug #46752)

• When running MySQL Workbench on Mac OS X, if a table was added to the model diagram and deletedthe application crashed. This happened for a new diagram from a schema imported from a live database.(Bug #45692)

• If the Table Editor had been invoked then the Text Boxes in the Tools, Preferences dialog becamevertically misaligned. This only happened for MySQL Workbench running on Mac OS X. (Bug #46255)

• On Mac OS X, it was not possible to resize a Text Object on the EER Diagram canvas. (Bug #45472)

References: See also Bug #39887.

• Attempts to rebuild the MySQL Workbench source RPM failed. The RPM appeared to contain anunmodified template mysql-workbench.spec.in instead of the correct spec file with variableplaceholders replaced by actual values.

When using the following command to rebuild the RPM:

shell> rpmbuild -ba --clean SPECS/mysql-workbench.spec.in

Page 431: MySQL Workbench

Changes in Release 5.2

423

This error was generated:

error: File /usr/src/packages/SOURCES/mysql-workbench-oss-@[email protected]: No such file or directory

Further, the spec file in the package had the incorrect suffix “.spec.in” instead of “.spec”. (Bug #45515)

• In the Physical Schemata pane if more schema were added than could fit within the pane, these schemacould not be viewed because there was no ability to scroll the pane. Further, double-clicking the schemain the Catalog pane did not locate the schema in the Physical Schemata pane.

MySQL Workbench was changed so that a small down arrow button was added to the right side of thePhysical Schemata tab bar. This provides a list to select a specific schema tab. (Bug #39735)

• When Help, About was selected from the main menu, it was not possible to copy MySQL Workbenchversion information to the clipboard. (Bug #39610)

• In the Columns tab of the Table Editor, if the column was of type ENUM and was given a default value,when an attempt was made to forward engineer the schema it would not validate. (Bug #44368)

• When a diagram was exported as PNG it used the height and width of the model as displayed in theEER Diagram. This resulted in the exported picture being too small or too large, rather than being scaledto a consistent size. (Bug #36226)

Changes in MySQL Workbench 5.2.2 (27 July 2009)

This section documents all changes and bug fixes applied since the release of 5.2.1.

Bugs Fixed

• The UML relationship notation was incorrect.

When setting a Foreign Key to NULLable, the table referenced by the Foreign Key should be marked asoptional. However, MySQL Workbench marked the table containing the Foreign Key itself as optional.(Bug #45069)

• If MySQL Workbench gave the message that the MySQL Server was no longer available (becauseof timeout due to inactivity) then MySQL Workbench crashed when the user tried to reconnect. (Bug#45123)

• The Synchronize Model with Database wizard contain a spelling mistake. The word “synchronization”was mispelled as “synchronizatiob”. (Bug #45939)

• MySQL Workbench 5.1.16 failed to create INSERTs in the exported DDL for some tables. (Bug #45920)

• MySQL Workbench crashed at startup on Mac OS X. (Bug #45869)

• If a user added a LIMIT clause to a query, the automatically added LIMIT 0,1000 clause caused asyntax error. (Bug #45051)

• The new SQL IDE, introduced in 5.2, did not support returning results from procedures. When anyroutine was called, there were no results displayed in the query editor window. However, the logcontained the message “Response: OK”.

When another query was run on the same connection, the log message was:

Error Code: 2014 Commands out of sync; you can't run this command now

Page 432: MySQL Workbench

Changes in Release 5.1

424

(Bug #44910)

Changes in MySQL Workbench 5.2.1 (22 May 2009)

This section documents all changes and bug fixes applied since the release of 5.2.0.

Version 5.2.1 has no changelog entries.

Changes in MySQL Workbench 5.2.0 (30 April 2009, Alpha)

This is the first alpha release of 5.2.0.

Version 5.2.0 has no changelog entries.

Changes in Release 5.1

Changes in MySQL Workbench 5.1.19 (06 September 2010)

This section documents all changes and bug fixes applied since the release of 5.1.18.

Functionality Added or Changed

• In the Forward Engineer SQL Script wizard the check box Generate DROP SCHEMA now causesevery CREATE SCHEMA statement to be prepended with DROP SCHEMA IF EXISTS `schemaname`.(Bug #46706)

Bugs Fixed

• The Omit Schema Qualifier in Object Names option in the Forward Engineer SQL Script wizardappeared to have no effect. After selecting this option and proceeding through the wizard, the generatedscript still contained schema qualifiers. (Bug #46268)

• Synchronizing a model with a live database, without having made any changes to the model or thedatabase, caused the model to appear as unsaved, indicating that unnecessary changes may have beenmade to the model. (Bug #40914)

• When synchronizing with a live database, if the direction of synchronization was changed to inbound, thescript generated indicated that no inbound changes would be made. (Bug #40648)

• MySQL Workbench EER Diagram view did not permit the creation of a foreign key constraint on aprimary key. (Bug #39546)

Changes in MySQL Workbench 5.1.18 (03 September 2009, General Availability)

This section documents all changes and bug fixes applied since the release of 5.1.17.

Functionality Added or Changed

• The Column Editor has been updated to remove the feature whereby a column could be toggled to aprimary key by double-clicking it. Primary key status can now only be set by selecting the appropriatecheck box in the adjacent Column Details frame. (Bug #46579)

• It was not possible to change column order by dragging and dropping columns in the Columns tab of theTable Editor. MySQL Workbench has been changed to enable you to drag and drop a column to changethe column order as required. (Bug #40601)

Bugs Fixed

Page 433: MySQL Workbench

Changes in Release 5.1

425

• In the Synchronize Model with Database dialog the text in the upper right area of the dialog did notwrap correctly, resulting in some text not being visible. (Bug #45455)

• When synchronizing with a live database, the script generated included drop statements that wereplaced in the wrong order, this led to the a schema being dropped after it was created. (Bug #46740)

• When editing a trigger, the trigger editor would automatically insert a delimiter during a pause in typing,and also relocate the cursor. (Bug #45929)

• When editing a stored routine or trigger in the Table Editor, the cursor would relocate to the top of theediting window if a key was not pressed for a few seconds.

Note

On Windows this issue was fixed in 5.1.18. On Mac OS X this issue was fixed in5.2.4. On Linux this issue was fixed in 5.2.7.

(Bug #48156)

• Clicking the Test Connection button in DB Connection Editor wizard did not appear to have any effect.(Bug #47083)

• MySQL Workbench generated an unhandled exception when using File, Export, Forward Engineer SQLCREATE Script. The exception was generated if an attempt was made to generate a script so that itwrote over a script already created. (Bug #47115)

• In the Columns tab of the Table Editor, when the empty row at the end of the column list was rightclicked, MySQL Workbench crashed with this error:

** (mysql-workbench-bin:15234): WARNING **: /tmp/sakila.mwbd1/document.mwb.xml:26: link'{591FC376-B82F-4F3D-B185-BA5C65B77080}' <object workbench.Workbench> key=owner could notbe resolved** Message: unhandled message 4: wb.file.openRecentModel finished in 0.58s

glibmm-ERROR **: unhandled exception (type std::exception) in signal handler:what: Index out of range.

aborting...Aborted

(Bug #46937)

• MySQL Workbench did not export Foreign Keys when using the File, Export, Forward Engineer SQLCREATE Script wizard, even though the option Skip Creation of FOREIGN KEYS check box wascleared. Further, MySQL Workbench crashed when a column with a Foreign Key was added to a table.(Bug #46783)

• MySQL Workbench crashed on launch on Mac OS X 10.6.0. (Bug #46953)

• The auto-completion of column names in the Table Editor completed names unnecessarily, requiringcharacters in the name to be manually deleted. This only happened on the Linux version of MySQLWorkbench. (Bug #46847)

• The Esc key did not initiate the closing of an active dialog box. (Bug #46829)

• Editing of Text Objects did not work correctly. When Enter was hit, line feed did not move editing to thenext line, and introduced a box character. (Bug #46789)

• MySQL Workbench generated an exception when the mouse wheel was used to move between tabs inthe Table Editor:

Page 434: MySQL Workbench

Changes in Release 5.1

426

(mysql-workbench-bin:4864): Gtk-CRITICAL **: gtk_tree_view_unref_tree_helper: assertion`node != NULL' failed

glibmm-ERROR **: unhandled exception (type std::exception) in signal handler:what: invalid index

aborting...Aborted

(Bug #46304)

• When an EER Diagram contained tables or views with underscores in their names, the context menuassociated with them displayed their names incorrectly in the menu. The underscores where displayedas accelerator keys in the context menu. (Bug #46302)

• The User Defined Types dialog, launched from Model, User Defined Types... on the main menu, did notpermit user-defined types to be changed. Further, it appeared to be possible to edit the new user type inthe User Types side panel, but no changes made there were retained.

MySQL Workbench has been changed to permit User Types to be edited only from the User DefinedTypes dialog, and correct operation of this dialog has been restored. (Bug #45936)

• In the Column tab of the Table Editor, if the NN check box was selected or deselected, the change wasnot immediately reflected in the EER Diagram, but was seen if some other operation caused the tableobject in the diagram to be refreshed. This also happened with the AI check box. (Bug #46869)

• The Forward Engineer SQL Script wizard generated invalid SQL code for a small model with foreignkeys:

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';

SET SQL_MODE=@OLD_SQL_MODE;SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

(Bug #46787)

• When the data type of a table column was changed in the Table Editor, it was not reflected in the EERDiagram, although the tooltip was updated correctly. This only happened in MySQL Workbench 5.1.17.(Bug #46940)

• When a N:M identifying relationship was created on a single table, a foreign key name collision occurred- both keys were given the same name. MySQL Workbench has been changed so that key names havea trailing number added to avoid conflicts. (Bug #46363)

• If the Default Storage Engine was selected as MyISAM in the Model Options dialog, when a new tablewas created in the EER Diagram it was found to have a storage engine type of InnoDB. (Bug #46752)

• The DDL was generated without foreign keys, regardless of whether the Skip generation of foreignkeys option was turned on. (Bug #46875)

• After using the Help, Update... to upgrade MySQL Workbench, the application failed to start correctly.After the splash screen was displayed MySQL Workbench displayed an error dialog - “MySQLWorkbench has stopped working”. (Bug #41460)

• The DBDoc documentation generation system did not support facilities for Stored Routines, Views andTriggers. (Bug #41589)

Page 435: MySQL Workbench

Changes in Release 5.1

427

• In the Physical Schemata pane if more schema were added than could fit within the pane, these schemacould not be viewed because there was no ability to scroll the pane. Further, double-clicking the schemain the Catalog pane did not locate the schema in the Physical Schemata pane.

MySQL Workbench was changed so that a small down arrow button was added to the right side of thePhysical Schemata tab bar. This provides a list to select a specific schema tab. (Bug #39735)

• Printing of an EER Diagram did not work correctly if a table vertically spanned multiple pages. In thiscase pages would be printed up to and including the page that contained the first part of the table thatspanned multiple pages, but the pages containing the remaining parts of the table would not be printed.This problem typically occurred when a table had more fields than could comfortably fit on a single page.(Bug #33919)

• When a diagram was exported as PNG it used the height and width of the model as displayed in theEER Diagram. This resulted in the exported picture being too small or too large, rather than being scaledto a consistent size. (Bug #36226)

Changes in MySQL Workbench 5.1.17 (14 August 2009)

This section documents all changes and bug fixes applied since the release of 5.1.16.

Functionality Added or Changed

• Bug reported: If code with an error was entered into the Triggers tab of the Table Editor, the codedisappeared when typing stopped.

What actually happened was when a table name was given that was not that of the table currently beingedited, the trigger code was moved to the table specified.

MySQL Workbench has now been changed so that if a table name is specified other than other than thatof the table being edited, then the table name is highlighted as a syntax error, rather than moving thetrigger code to the table actually specified. (Bug #46349)

• When a model with multiple EER Diagrams was opened, all EER Diagrams would be displayed in tabs.This happened whether or not a EER Diagram had been displayed in a tab prior to saving the model.

MySQL Workbench has been changed so that the EER Diagram tab state is saved, so that when amodel is opened, only those EER Diagram tabs that were open on save are restored. This preventsunnecessary cluttering of the interface. (Bug #44454, Bug #50732)

• When a Text Object was placed on an EER Diagram it could not be resized and also did not appear toautomatically resize correctly around any text entered.

Text Objects on the EER Diagram canvas can now be resized by grabbing the sizing handles thatappear when the object is selected. As with Table Objects, a manual modification of the object sets themanualSizing attribute of the Text Object to true. This property can also be set in the Propertiespane. This means that these Text Objects automatically expand on entering more text, but the size isn'tautomatically reduced when text is removed or wrapped manually. By setting this property to false, theText Object size is also automatically reduced to fit the containing text. (Bug #39887)

• In the Foreign Keys tab it was not possible to rename a foreign key by renaming the correspondingindex entry.

MySQL Workbench has been changed so that it is possible to rename a foreign key by renaming itscorresponding index. The foreign key name is now automatically updated when the index is renamed.The index name is also updated when the foreign key name is changed. (Bug #39511)

Page 436: MySQL Workbench

Changes in Release 5.1

428

• The menu item Help, View Reported Bugs has been added to the main menu. This opens the bugslisting for MySQL Workbench in the default browser. (Bug #32813)

• In MySQL Workbench it was not possible to generate an export script without schema information.MySQL Workbench has been changed to include the option Omit Schema Qualifier in Object Names.This can be found in the Forward Engineer SQL Script and Forward Engineer to Database wizards.

Note that this does not change the script used in Procedures or Views. If you are using schema qualifiersin these locations you will have to remove them manually. (Bug #34827)

Bugs Fixed

• During Forward Engineering, clicking the Copy to Clipboard button generated code that contained anextra newline per line. (Bug #45579)

• The text contained in a Text Object in an EER Diagram was syntax highlighted. This was not appropriatefor a simple text note. (Bug #46092)

• When compiling the MySQL Workbench source with GNU C Compiler (GCC) version 4.4.0, thecompilation failed because the version of the Boost library used was not compatible with GCC 4.4.0.

The version of the Boost library required for compatibility with GCC 4.4.0 is 1.37 or later. (Bug #45798)

• If an attempt was made to copy and paste a trigger, the trigger code would revert to the source trigger,when the pasted trigger was edited.

MySQL Workbench has been changed so that triggers are associated with the table in which they areedited. If a trigger has the wrong schema or table pointed to by its CREATE TRIGGER statement, it willbe highlighted as a syntax error. (Bug #45931)

• In the Columns tab of the Table Editor, if a default value was added for a column, it could not then beremoved. (Bug #46509)

• The Microsoft Windows version of MySQL Workbench leaked GDI objects, resulting in a drop inperformance. (Bug #46101)

• The INSERT statements generated for columns of type TEXT by the Insert Editor were not correctbecause the values were not quoted. Also, when the Insert Editor was closed and then reopened the lastcolumn entry was lost. (Bug #46390)

• MySQL Workbench crashed and also lost procedure objects when attempting to synchronize with a livedatabase. (Bug #45773)

• When trying to connect to a server from MySQL Workbench, this error was generated:

Connection 'Server' could not be established: No bool value passed for CLIENT_COMPRESS

This occurred when using connections created in MySQL Workbench 5.2.1 with 5.2.2. (Bug #46635)

• On the EER Diagram, if an Undo operation was carried out after an Autosize operation, table objectswere reduced to their minimum size. (Bug #46605)

• Relationship lines were not always drawn on the EER Diagram. (Bug #45583)

• If an attempt was made to load a new model file while a model file was already loaded, this error dialogwas generated:

OverviewBE::get_node: invalid node 1.1

(Bug #46292)

Page 437: MySQL Workbench

Changes in Release 5.1

429

• When an attempt was made to synchronize Stored Procedures from the source database to MySQLWorkbench, the Stored Procedures were deleted from the source database. (Bug #46346)

• If the Table Editor had been invoked then the Text Boxes in the Tools, Preferences dialog becamevertically misaligned. This only happened for MySQL Workbench running on Mac OS X. (Bug #46255)

• When an SQL Script was added and then its name changed, the name would erroneously revert back to“Script”. (Bug #46246)

• The settings for ON UPDATE and ON DELETE in Foreign Key/Relationship Defaults set in the Model tabof Tools, Preferences, were not taken into account when new tables and relationships were created.(Bug #45393, Bug #45239)

• When synchronizing a model with a live database, clicking the Update Model actually caused the serverto be updated as if Update Source had been clicked. (Bug #45456)

• An Unknown Exception was caught after placing a relationship between two tables in the EER Diagram.The exception generated was:

Unknown Exception caught in: c:\documents and settings\mysqldev\my documents\visualstudio 2008\projects\workbench\backend\windows\wbprivate.wr\src\Wb.h at line 1026

(Bug #46562)

• Reverse Engineering from a live database failed if the server had sql_mode set to ANSI_QUOTES. (Bug#46185)

• When a model was synchronized with a live database, and only stored procedures needed to besynchronized, this error was generated:

ERROR: Error 1046: No database selected

(Bug #45867)

• When Plugins, Catalog, Give a Prefix to All Tables in Catalog, was selected from the main menu,MySQL Workbench crashed with this error:

** (mysql-workbench-bin:5898): WARNING **:/home/miguel/.mysql/workbench/wb_options.xml:325: link'b7ee49b4-67f5-11de-9d1e-0800272fd858' <object GrtObject> key=owner could not be resolved** Message: item_activated: 0xadbb608 -> 'plugin:wb.file.newDocument'** Message: unhandled message 4: wb.file.newDocument finished in 0.34s

** Message: item_activated: 0xaacbea8 -> 'plugin:wb.util.prefixTables'

glibmm-ERROR **:unhandled exception (type std::exception) in signal handler:what: request_input_becb not implemented

aborting...Aborted

This only happened when running on Linux. (Bug #46280)

• In the Columns tab of the Table Editor, selecting the AI check box before entering a name for thecolumn caused MySQL Workbench to crash. (Bug #46150)

• The Forward Engineering SQL ALTER Script wizard generated DROP INDEX and ADD UNIQUEINDEX statements for any unique index, even for one that had not been modified. These unnecessarystatements had to be manually deleted from the script. (Bug #45830)

Page 438: MySQL Workbench

Changes in Release 5.1

430

• When writing code in the Routine Editor it appeared that the code was lost if the Routine Editor wasclosed. (Bug #46049)

• When using the Reverse Engineer Database wizard a Segmentation Fault was generated by MySQLWorkbench on Ubuntu Linux:

(mysql-workbench-bin:22735): Gtk-CRITICAL **: gtk_tree_selection_get_selected: assertion`selection->type != GTK_SELECTION_MULTIPLE' failed** Message: item_activated: 0x30d4920 -> 'plugin:db.plugin.database.rev_eng'** Message: unhandled message 4: db.plugin.database.rev_eng finished in 0,00s

(Bug #46078)

• Calling the Plugins, Catalog, Dump All Table Columns item from the main menu generated this error:

Error executing plugin wb.catalog.util.dumpColumns: error callingPyWbUtils.printAllColumns: 'str' object is not callable

(Bug #46477)

• When building MySQL Workbench on PowerPC/PowerPC64 on Linux, the build failed because“bswap32” was not defined.

In file included from src/template_string.cc:47:src/base/arena.h: In member function 'void google::BaseArena::ReturnMemory(void*,size_t)':src/base/arena.h:211: warning: comparison between signed and unsigned integer expressionssrc/template_string.cc: In function 'uint32 UNALIGNED_LOAD32(const void*)':src/template_string.cc:120: error: 'bswap32' was not declared in this scope

(Bug #45629)

• In the EER Diagram, if a layer was double-clicked a new tab was added to the Table Editor. However,if a relationship or table was double-clicked any existing tab would be reused, rather than a new tabbeing created. There appeared to be no consistent policy on how double-clicks should be handled. (Bug#46466)

• In the EER Diagram, when hovering the cursor over a column in a table, the hint box contained the textassociated with the subsequent column, and the first column hint box contained the name of the table.(Bug #45997)

• MySQL Workbench crashed if a table was selected, right-clicked, and then the menu item Copy SQL toClipboard chosen.

MySQL Workbench also crashed with the same model if an attempt was made to export the schemausing the Forward Engineer SQL CREATE Script wizard. (Bug #46025)

• In MySQL Workbench running on Mac OS X, if any changes were made in the Page Setup dialog, thiserror was generated:

builtin:wb.page_setup

Type mismatch: expected object of type app.PaperType, but got app.PaperType

Note, the Page Setup dialog is accessed by selecting File, Page setup... from the main menu. (Bug#45861)

• On Mac OS X, it was not possible to resize a Text Object on the EER Diagram canvas. (Bug #45472)

References: See also Bug #39887.

Page 439: MySQL Workbench

Changes in Release 5.1

431

• Attempts to rebuild the MySQL Workbench source RPM failed. The RPM appeared to contain anunmodified template mysql-workbench.spec.in instead of the correct spec file with variableplaceholders replaced by actual values.

When using the following command to rebuild the RPM:

shell> rpmbuild -ba --clean SPECS/mysql-workbench.spec.in

This error was generated:

error: File /usr/src/packages/SOURCES/mysql-workbench-oss-@[email protected]: No such file or directory

Further, the spec file in the package had the incorrect suffix “.spec.in” instead of “.spec”. (Bug #45515)

• The Synchronize Model with Database wizard contain a spelling mistake. The word “synchronization”was mispelled as “synchronizatiob”. (Bug #45939)

• MySQL Workbench 5.1.16 failed to create INSERTs in the exported DDL for some tables. (Bug #45920)

• MySQL Workbench crashed at startup on Mac OS X. (Bug #45869)

• MySQL Workbench 5.1.13 running on Ubuntu Linux crashed when it attempted to load a model filecreated using MySQL Workbench 5.0 on Windows XP. The same model file did load correctly usingMySQL Workbench 5.1.12. (Bug #45491)

• When Connect to Columns was selected for the Relationship Notation option, the line connecting aforeign key to its referenced table was drawn to the incorrect column. (Bug #40627)

• In the Forward Engineer SQL Script wizard, on the SQL Object Export Filter page, if Back wasclicked to go to the SQL Export Options page, and then Next was clicked to return to the SQL ObjectExport Filter page, on that page all sections were duplicated. If this was repeated the objects weretriplicated and so on. (Bug #44317)

• When Help, About was selected from the main menu, it was not possible to copy MySQL Workbenchversion information to the clipboard. (Bug #39610)

• The Inserts Editor did not have functionality to remove a row once added. This problem only occurredwith MySQL Workbench running on Linux. (Bug #44458)

• The script created by Forward Engineer SQL CREATE Script failed with an error if the model containeda view that referenced a column defined in another view. (Bug #43061)

• In the Columns tab of the Table Editor, if a column was deleted, and it had inserts in the Inserts tab, inthe Inserts tab the last entry would be incorrectly deleted. (Bug #41931)

• In the Columns tab of the Table Editor, when setting a column data type to ENUM it was not possible tochoose Collation for the column details. Only the Table Default collation was available. (Bug #43352)

• In the Foreign Keys tab of the Table Editor, the values of the On Update and On Delete fields, in theForeign Key Options pane, did not always refresh for each Foreign Key constraint selected in the tableon the left side.

For example, if the currently selected constraint was SET NULL for On Delete, and then a differentselection was made for a constraint that has no action specified for On Delete, the field remained withthe value from the previous selection, which gave a false indication that such action was specified in thedefinition of the newly selected constraint.

Page 440: MySQL Workbench

Changes in Release 5.1

432

Note that incorrect field values were only displayed when the last selected constraint did not have anaction defined. (Bug #41887)

• In the Columns tab of the Table Editor, a column name could be entered with leading or trailing spaces.That led to this error when exporting the schema:

ERROR 1166 (42000): Incorrect column name 'name '

(Bug #43345)

• A model failed to synchronize with a live database because a column of type DOUBLE was exported as atype DOUBLE(256). (Bug #41290)

• When a MySQL Workbench model was synchronized with a live database, a foreign key relationship,recently added to the database, was not reflected in the EER Diagram. Although the foreign key wascreated in the table object, the relationship connector widget was not drawn on the canvas. (Bug#41219)

• In the Columns tab of the Table Editor, if a column is dragged and dropped to change its position, afterthe move the column highlighted is not the one moved. (Bug #42476)

• In the Columns tab of the Table Editor, if the column was of type ENUM and was given a default value,when an attempt was made to forward engineer the schema it would not validate. (Bug #44368)

• When the flags of a User Defined Type were changed in the User Types panel, the change was notupdated in the EER Diagram, the Table Editor, or the exported SQL. (Bug #41453)

• In the Columns tab of the Table Editor, when moving a column lower in the list of columns using dragand drop, the column was incorrectly placed one position below the point indicated by the positionmarker. (Bug #40641)

• Foreign Key checks were not enabled before the standard inserts section of the script started. (Bug#35180)

Changes in MySQL Workbench 5.1.16 (30 June 2009, General Availability)

This section documents all changes and bug fixes applied since the release of 5.1.15. This is the firstGeneral Availability (GA) level release of 5.1.

Functionality Added or Changed

• The MySQL Workbench Tools, Options... menu item has been renamed to Preferences..., and thecorresponding dialog now has the title Workbench Preferences. (Bug #44462)

• When a relationship was edited in the EER diagram, a new tab was created in the Table Editor, ratherthan using any existing relationship tab. For example, if one relationship tab existed, and then anotherrelationship was edited, a new tab would be created, rather than using the existing tab. (Bug #39624)

• In an EER diagram, if a table contained enums with many values, the table was excessively wide, andhad to be manually resized.

Version 5.1.16 now features a new preference setting which lets you specify the maximum length of adata type definition string, to be displayed in a table in an EER diagram. This is available for ENUM andSET types. Data type definitions that exceed these lengths are displayed as SET/ENUM(...) in theEER diagram.

The new setting can be found by selecting Tools, Preferences from the main menu, and then selectingthe Diagram tab. The settings are then available in the Tables panel. (Bug #34919)

Page 441: MySQL Workbench

Changes in Release 5.1

433

Bugs Fixed

• When an attempt was made to add a new table to a schema page other than the default MySQL Modelpage, this error was generated:

Unknown Exception caught in c:\documents and settings\mysqldev\my documents\visual studio2008\projects\workbench\backend\windows\wbprivate.wr\src\Wb.h at line 1026

(Bug #45821)

• When a model was exported using either File, Export, Forward Engineer SQL CREATE Script orDatabase, Forward Engineer..., MySQL Workbench crashed with a segmentation fault. This occurredafter the objects to export were selected, it did not matter if one or all objects were selected. Thisoccurred using MySQL Workbench 5.1.14 RC on Ubuntu Linux and Windows. (Bug #45718)

• Right-clicking in a blank area of the User Types window generated an exception:

System.NullReferenceException: Object reference not set to an instance of an object. at MySQL.GUI.Workbench.UserDatatypesForm.contextMenuStrip1_Opening(Object sender,CancelEventArgs e) at System.Windows.Forms.ToolStripDropDown.OnOpening(CancelEventArgs e)...

(Bug #45490)

• The data type ENUM did not accept parenthesis in its values. (Bug #45607)

• In the Columns tab of the Table Editor, when a column was right-clicked to display the context-sensitivemenu, the Move Up and Move Down menu items were disabled. This meant that the order of thecolumns could not be changed in the normal manner. (Bug #45590)

• If font size was changed in the Appearance tab of the Workbench Preferences dialog, this had noimmediate effect on the visual appearance of the EER Diagram. (Bug #38198)

• In the Forward Engineer SQL Script wizard, the location opened by the Browse button defaulted tothe MySQL Workbench install directory. However, after an output script file was set the location openedby the Browse button returned to the default, rather than remembering the last location accessed. Thisrequired navigating to the correct location each time the script was regenerated. (Bug #43837)

• In the Forward Engineer SQL CREATE Script wizard, the Generate INSERT Statements forTables option did not take into account which tables were excluded in the SQL Export Filters. All insertstatements were generated, including those for tables that had been excluded in the export filters. (Bug#40913)

• When attempting to enter trigger code into the Triggers tab of the Table Editor, a timer appeared toperiodically fire, which caused the delimiter to be added while typing.

This only happened when using the Mac OS X version of MySQL Workbench. (Bug #44264)

• In the EER Diagram, right-clicking to edit a table sometimes failed with the following error:

Cannot execute db.mysql.plugin.edit.tablePlugin requires unhandled argument type.

(Bug #39513)

• MySQL Workbench displayed incorrect icons in the Table Editor. The icons for columns displayed in thetable editor did not match those displayed in the EER Diagram. (Bug #42794)

Page 442: MySQL Workbench

Changes in Release 5.1

434

• When a table was renamed, inserts that had been created for it disappeared. Further, when a table wasupdated in Physical Schemata or in the Catalog pane, inserts were not updated. (Bug #38654)

• In the Indexes tab of the Table Editor, it was not possible to change the order number of a column foran index of type PRIMARY in the Index Columns panel, using the list available in the # column. (Bug#37273)

• When zooming an EER Diagram, the text in a table would sometimes extend beyond the edge of thetable box. (Bug #35407)

Changes in MySQL Workbench 5.1.15 (26 June 2009)

This section documents all changes and bug fixes applied since the release of 5.1.14.

Functionality Added or Changed

• A routine object was deleted if its code was removed from the routine group. This behavior has nowbeen noted in the main documentation. (Bug #45738)

Bugs Fixed

• In the Forward Engineer SQL Script wizard, when the Show Filter button was clicked, the left handpanel containing database and table names was too narrow, especially if a long database name or tablename was used. This made it hard to determine which tables to select. (Bug #45623)

• Selecting Database, Generate Catalog Diff Report from the main menu caused MySQL Workbench tocrash. (Bug #45652)

• The File, Export, Forward Engineer SQL CREATE Script wizard contained malfunctioning buttons.When prompted with the message “Do you want to overwrite an existing .sql file?”, the Replace andCancel buttons had the reverse effect. Clicking Replace cancelled the action, whereas clicking Cancelproceeded to the next step. (Bug #45619)

• Generated INSERT statements did not have a database name.

The generated INSERT statements were at the end of the SQL output. However, there was no USEdatabase statement before the group of inserts. The comment before the group of INSERTS did refer tothe database table.

If you had multiple databases, this generated errors on import. (Bug #45642)

• MySQL Workbench Synchronize Model feature had unexpected behavior. For example, synchronizingthe model with the live database would cause changes to the database, even if this was not desired.Also, if tables were dropped in the live database, and the model synchronized, the changes to the livedatabase were not reflected in the model. Further, if a model was created and synchronized to an emptyschema in the live database, when synchronization took place again, MySQL Workbench would indicatemany changes were required, even if no changes had been made to the model or database. (Bug#42149)

• In Ubuntu Linux, right-clicking any item in the Catalog, Layers, User Types, or History tabs, or othertabs typically docked in the right hand side of MySQL Workbench, did not display a context-sensitivemenu. (Bug #44298)

• Double-clicking a layer in the Layers tab did not select it in the EER Diagram canvas. However, otherobjects in the Layers tab could be selected on the EER Diagram canvas in this manner. (Bug #34938)

• Right-clicking a relationship in the EER Diagram canvas, and selecting Edit in New Window... from thecontext-sensitive menu, had no effect. (Bug #34069)

Page 443: MySQL Workbench

Changes in Release 5.1

435

Changes in MySQL Workbench 5.1.14 (19 June 2009)

This section documents all changes and bug fixes applied since the release of 5.1.13.

Bugs Fixed

• On Mac OS X, MySQL Workbench crashed when creating a new document after another one had beenworked on.

If editing a document, and then selecting to create a new document and not saving the current documentwhen prompted, MySQL Workbench crashed when the save dialog closed. (Bug #45519)

• Printing an EER diagram crashed MySQL Workbench. (Bug #45518)

• When synchronizing a model with a database, rather than synchronizing only the selected tables, alltables were synchronized. (Bug #43485)

• When right-clicking an item that was not selected, such as a table or routine, in the MySQL Model tab,the item was selected without the other items being deselected.

The expected behavior for applications in both Windows and Linux is that right-clicking an item that hasnot been selected, should deselect all other items. Right-clicking an already selected item should notalter any of the selections. (Bug #44268)

Changes in MySQL Workbench 5.1.13 (12 June 2009)

This section documents all changes and bug fixes applied since the release of 5.1.12.

Bugs Fixed

• MySQL Workbench did not limit foreign key name length. This meant that an exported SQL script wasinvalid and MySQL Server generated an error on attempting to import it:

1059 - ER_TOO_LONG_IDENT

(Bug #45139)

• When using the Generate Catalog Diff Report wizard, the Stored Connection information was notautomatically populated when a previously defined Stored Connection was selected. (Bug #45234)

• On Mac OS X, using the Forward Engineer to Database, or Forward Engineer SQL Script wizardscaused MySQL Workbench to generate this error message:

The application MySQLWorkbench quit unexpectedly after it was relaunched.

(Bug #45229)

• When using the Forward Engineer SQL Script wizard, the SQL Object Export Filter step displayedduplicate items. (Bug #45241)

• When defining a primary key with a user-defined data type, it was not possible to set the auto-increment(AI) attribute. Clicking the AI check box had no effect.

To circumvent this problem it was possible to temporarily change the data type of the column to a built-in data type such as INT, set the AI attribute and then change the data type back to the desired user-defined data type. The model could then be saved. However, if this model was reopened and File,Export, Forward Engineer SQL CREATE Script used to generate a script, MySQL Workbench wouldcrash. (Bug #45165)

Page 444: MySQL Workbench

Changes in Release 5.1

436

• Adding Insert records for a table worked correctly. However, there was no way to remove the recordsonce the Open Editor facility has been used to add them. (Bug #45233)

• When trying to synchronize a model to a database, tables defining some columns as FLOAT or DOUBLEprevented the synchronization SQL script from working.

The SQL generated used the syntax FLOAT(256) or DOUBLE(256) which was rejected by MySQLServer 5.0.51a.

Editing the generated script manually to use just FLOAT or DOUBLE worked. However, MySQLWorkbench then assumed the target table was not correctly synchronized, and prompted the useraccordingly. (Bug #40169)

• In the table editor, when a column was added with a data type of TIMESTAMP, and the default value of0 entered, MySQL Workbench erroneously added quotation marks around the 0. Any generated SQLscript therefore contained errors, and would subsequently fail. (Bug #44006)

• MySQL Workbench frequently crashed with an unknown exception in Wb.h at line 1010.

This occurred while working on tables within EER diagrams on a design consisting of more than 190tables and 20 EER diagrams. (Bug #41325)

• In the table editor the VARBINARY data type was not listed in the list for columns. (Bug #44023)

• When tables with relationship connectors were dragged or copied from one EER diagram to another, theconnectors were not always drawn. (Bug #38545)

• Changing a relationship's visibility had no effect.

If a relationship was right-clicked in the EER diagram, Edit Relationship selected, and then theRelationship tab selected, the visibility radio buttons were displayed. However, if the visibility settingswere changed there was no effect. (Bug #44988)

• When a relationship was fully visible in the EER diagram, if the user chose to have it drawn split, orhidden, MySQL Workbench behaved as expected. However, if the relationship was hidden, and theuser chose to have it drawn split, or fully visible again, the relationship was not properly redrawn. Theuser had to move either of the tables involved in the relationship to have the relationship redrawn. (Bug#40015)

• It was not possible to rename a table created using Add Table, by copying text into its text field. (Bug#44913)

• MySQL Workbench appeared not to display table rows in an EER diagram for tables that had more than20 columns.

MySQL Workbench now includes the ability to manually resize the table, besides automatically limitingthe number of columns to a user selectable value, by order of appearance, regardless of being keycolumns or not. (Bug #44675)

• Invisible characters in a reverse engineered script caused errors to be generated when the same scriptwas forward engineered.

The problem was due to the reverse engineered script containing a mixture of \n, \r and \r\n line endings.These are now normalized to \n in the reverse engineering code. The validation process now alsochecks SQL code objects to ensure valid line endings. (Bug #41254)

• When synchronizing a model with a database, using the Synchronize Model with Database wizard, thedata type translation resulted in errors. (Bug #42728)

Page 445: MySQL Workbench

Changes in Release 5.1

437

• When working in the Routines tab of the Routine Group editor, the Routine tab did not appear to savechanges to routine code.

If code was copied from an external application into the Routine tab, then the model saved and MySQLWorkbench exited, then on restarting MySQL Workbench, any changes to the routine code were lost.(Bug #40885)

• Foreign key names must be unique. However, MySQL Workbench default generated foreign key nameswere sometimes identical, causing Forward Engineer SQL CREATE Script to fail. (Bug #45027)

• When in the Columns tab of the Table Editor, if an attempt was made to change a column data type toINTEGER(n) this would have no effect and the column data type would remain unchanged. However, ifINT(n) was entered this was accepted and the data type changed accordingly. (Bug #44552)

• The Forward Engineer SQL Script wizard would write over an existing file without prompting the userfor confirmation. (Bug #44437)

• On Mac OS X, an application window's red close button should contain a solid circle if the currentdocument is unsaved. However, for MySQL Workbench this did not work correctly. Although the circlewas initially shown, it was not displayed after subsequent edits to the model. (Bug #44435)

• The Copy SQL to Clipboard menu item, which was normally available when right-clicking a table inMySQL Workbench, was not displayed. (Bug #44254)

• When editing a column's type in the Columns tab of the Table Editor, the list for selecting the data typedisplayed BOOL. However, once that had been selected the data type was displayed as BOOLEAN.

Further, if a column data type was set by entering INTEGER in the Datatype column, it then changed toINT on pressing return. (Bug #41934)

• Synchronization of the model with an external database failed to report errors. This meant there was thepossibility of an incomplete synchronization, without the developer being informed. (Bug #45024)

• On the Linux version of MySQL Workbench it was not possible to rename a layer by double-clicking it inthe Layers window (which is typically docked to the right hand side of the screen).

A layer editor has now been added to the Linux version of MySQL Workbench. This can be activated bydouble-clicking the layer's title. (Bug #44972)

• Using the Foreign Keys tab of the Table Editor, it was not possible to correctly create multiple foreignkey relationships. (Bug #44701)

• In the Workbench Preferences dialog, on the Diagram tab, in the Tables panel, the check boxesShow Column Types and Show Column Flags did not work correctly. Selecting or deselecting ShowColumn Types only had an effect when MySQL Workbench was restarted. Selecting Show ColumnFlags had no effect at all, and the flags were never displayed. (Bug #44586)

• The Forward Engineer SQL Script wizard did not emit table INSERT statements in the generated scriptwhen requested to do so. (Bug #43799, Bug #44385)

• On Ubuntu Linux, the following MySQL Workbench menu items did not work: Page Setup, Print Previewand Print.

If those menu items were selected, these console messages were generated:

** Message: item_activated: 0xaa44bf0 -> 'builtin:wb.page_setup'** Message: show_progress_becb not implemented** Message: unhandled message 4: wb.print.setup finished in 0,00s

Page 446: MySQL Workbench

Changes in Release 5.1

438

** Message: show_progress_becb not implementedcreate font Helvetica 0 0 11,000000 (200)** Message: item_activated: 0xa4c9800 ->'plugin:wb.print.printPreview'** Message: show_progress_becb not implemented

** (mysql-workbench-bin:11732): WARNING **: Could not open editor shared object'/usr/lib/mysql-workbench/plugins/'** Message: unhandled message 4: wb.print.printPreview finished in 0,00s

** Message: show_progress_becb not implemented** Message: item_activated: 0xa4cec08 -> 'plugin:wb.print.print'** Message: show_progress_becb not implemented** Message: unhandled message 4: wb.print.print finished in 0,00s

** Message: show_progress_becb not implementedcreate font Helvetica 0 0 11,000000 (300)

(Bug #44524)

• When editing a foreign key in the Foreign Keys tab of the Table Editor, and then removing thecorresponding relationship from the EER Diagram canvas, the Foreign Keys tab remained open andpopulated, instead of being cleared and closed. (Bug #39478)

• When Workbench:copyToClipboard() was used from within a plugin, only garbage characters werecopied to the Windows clipboard. This affected the operation of plugins.

When a plugin attempted to output the string “abcdefghijklmnopqrstuvwxyz0123456789!§$%&/()=” aruntime exception was generated. (Bug #44461)

• On Mac OS X, if the mouse pointer was used to select an entity and then Command+Delete waspressed before the tooltip appeared, MySQL Workbench crashed when the delete was confirmed. (Bug#45042)

• When attempting to delete an existing EER diagram, MySQL Workbench crashed.

The origin of the diagram seemed to have no bearing on whether the crash occurred because ithappened both with diagrams created from reverse engineering and those created independently. (Bug#44407)

• On Ubuntu Linux, MySQL Workbench crashed with a segmentation fault when an attempt was made tosave the model. (Bug #44974)

• On Debian Linux (Lenny), after adding a second table and selecting AI on the first column element,MySQL Workbench generated a segmentation fault. (Bug #44612)

• Deleting or cutting a Relation from an EER diagram crashed MySQL Workbench. (Bug #44340)

• When a Routine Group was renamed, this was not immediately updated in the EER diagram. (Bug#44503)

• In the Flags box, which is located in the Column Details panel in the Table Editor, the same flagswere not listed as available for both the INT and INTEGER data types. INT has both UNSIGNED andZEROFILL listed, but these were not listed for the column if it was of type INTEGER. Also, the AI checkbox was not selectable for columns defined as INTEGER. (Bug #44872)

• When a new index was created in the Indexes tab for a table that already had indexes, the previouslydisplayed index field remained selected. This caused concern that the newly created index would be onthe wrong field. (Bug #44532)

• The Forward Engineer SQL Script wizard did not permit the SQL script text to be copied using thekeyboard shortcut. Only the mouse could be used to select and copy the text. (Bug #44531)

Page 447: MySQL Workbench

Changes in Release 5.1

439

• If the order of columns was changed in the Columns tab, this was not reflected in the EER diagram.(Bug #44240)

• When exiting MySQL Workbench with unsaved changes, you are given the choices Save, Don't Saveand Cancel. When Cancel was clicked, MySQL Workbench exited without saving, rather than returningto the application without making any changes.

This only happened when clicking the main application Close button, in the upper right corner. It did nothappen if the application was exited by selecting File, Exit from the main menu. (Bug #44267)

• Omit Schema Qualifiers did not omit schema for foreign keys.

When using File, Export, Forward Engineer SQL CREATE Script and selecting the Omit SchemaQualifiers check box, the schema for foreign keys were not omitted. (Bug #42328)

• When Relations were deleted using the Foreign Keys tab, MySQL Workbench intermittently generatedan exception:

System.AccessViolationException: Attempted to read or write protected memory. This isoften an indication that other memory is corrupt. at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method,Object[] args, Boolean synchronous) at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args) at System.Windows.Forms.Control.Invoke(Delegate method) at MySQL.GUI.Workbench.Plugins.ObjectEditorPlugin.RefreshFormDataInvoke() at MySQL.Grt.DelegateSlot0<void\,void>.cpp_callback() at sigc.pointer_functor0<void>.()(pointer_functor0<void>* ) at sigc.adaptor_functor<sigc::pointer_functor0<void>>.()(adaptor_functor<sigc::pointer_functor0<void> >* ) at sigc.internal.slot_call0<sigc::pointer_functor0<void>,void>.call_it(slot_rep* rep) at MySQL.Grt.Db.TableEditorBE.remove_fk(NodeId fk) atMySQL.GUI.Workbench.Plugins.DbMysqlTableEditor.deleteSelectedFKsToolStripMenuItem_Click(Object sender, EventArgs e) at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e) at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e) at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e,ToolStripItemEventType met) at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventTypemet) at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ToolStrip.WndProc(Message& m) at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam,IntPtr lparam)

(Bug #44326)

Changes in MySQL Workbench 5.1.12 (27 April 2009)

This section documents all changes and bug fixes applied since the release of 5.1.11.

Bugs Fixed

Page 448: MySQL Workbench

Changes in Release 5.1

440

• In the Foreign Key tab of the Relationship Editor, the two buttons labeled Edit Table... were inactive.Clicking them had no effect. (Bug #45391)

• It was not possible to change the Default Collation for any schema. (Bug #44220)

• When running on Ubuntu Linux the edit window in MySQL Workbench was not expanded horizontally bydefault.

When editing existing routines, the horizontal scroll-bar covered 100% of the visible area, no matter howlong any of the rows are. This meant that if a row expanded outside the visible area, it was not possibleto scroll sideways to see the rest of the row. All of the row was there, but the right part was not visible.(Bug #44296)

Changes in MySQL Workbench 5.1.11 (Not yet released)

This section documents all changes and bug fixes applied since the release of 5.1.10.

Bugs Fixed

• When using MySQL Workbench on Linux, if a new layer was created it was not possible to then changethe layer's name in the Properties tab. (Bug #44202)

• MySQL Workbench crashed when attempting to delete an EER diagram from the EER Diagramssection of the main project tab. (Bug #44245)

Changes in MySQL Workbench 5.1.10 (10 April 2009)

This section documents all changes and bug fixes applied since the release of 5.1.9.

Bugs Fixed

• In the EER Diagram view, if the Tables folder was expanded in the Catalog Palette, and then a tabledragged onto the EER Diagram, the expanded Tables folder immediately collapsed. (Bug #41922)

• An attempt to edit a table resulted in this error:

The plugin db.mysql.editors.mwbplugin does not contain the published object DbMysqlTableEditor

This only happened if the project was opened immediately after MySQL Workbench was started. (Bug#43863)

• Soon after MySQL Workbench was launched, error popup dialogs were generated with this message:

"AXDocument" attribute unsupported by <some component>

This occurred on the Mac OS X version of MySQL Workbench, when a third-party usage monitoringutility was running. This error was due to the fact that custom exception reporting was disabled bydefault. (Bug #43872)

• If a MySQL Workbench project file was opened, all tabs closed, and then File, New selected, MySQLWorkbench crashed with this error message:

Unknown exception caught in c:\users\tax\documents\visual studio 2008\projects\wb5.1\workbench\backend\windows\wbprivate.wr\src\Wb.h at line 994.

(Bug #43850)

• If an attempt was made to use the undo feature after having first saved a project, MySQL Workbenchcrashed. (Bug #43849)

Page 449: MySQL Workbench

Changes in Release 5.1

441

• It was not possible to edit the cardinality of existing relations using the MAC OS X version of MySQLWorkbench. Attempting to change the cardinality using the radio buttons had no effect. For example, itwas not possible to change a relation from one-to-many to one-to-one. (Bug #44043)

• When a foreign key was created, a column was selected in the original table, but no column wasselected in the foreign table. If the project was saved and an attempt was made to reload it, this errormessage was generated:

Unserializing GRT data - Inserting null value to not null list

This error prevented MySQL Workbench from opening the project file, resulting in all model data beinginaccessible. (Bug #43997)

• Data entered using the Inserts tab in the Table Editor was not displayed in the Inserts tab, but wassaved to the MWB file when the project was saved. The data could be viewed in MySQL Workbenchrunning on platforms other than Mac OS X, but the Mac OS X version of MySQL Workbench did notdisplay the data entered using the Inserts tab. (Bug #43907)

• When creating a new 1:n link MySQL Workbench froze. (Bug #43812)

• Using the Navigator to zoom in and out of an EER diagram view caused MySQL Workbench to crash.(Bug #43782)

• When a plugin was installed using the Tools, Install Plugin/Module File... menu option, MySQLWorkbench copied the selected plugin and reported:

'Copied module /Users/tilman/Desktop/SymfonyYmlExport.grt.lua to'/Users/tilman/Library/Application Support/MySQL/Workbench/modules/SymfonyYmlExport.grt.lua'Please restart Workbench for the change to take effect.'

When restarted, MySQL Workbench crashed. MySQL Workbench could only be fully restarted by firstremoving the installed file from the modules directory. (Bug #43906)

• When a nonstandard port was specified in Database, Forward Engineer..., such as 3307, MySQLWorkbench still attempted to connect to port 3306. (Bug #44014)

• The name of the table displayed on the tab in the Table Editor did not update when the table name waschanged in the editor. (Bug #43960)

• The Many-to-Many Table generated by MySQL Workbench was of engine type Server Default. It shouldhave been of type InnoDB. (Bug #43776)

• On opening a diagram the file tables layout was broken. All tables were placed in the top left corner.

It appeared that MySQL Workbench stored the diagram layout in the MWB file correctly but it was notretrieved correctly on file load. (Bug #43455)

Changes in MySQL Workbench 5.1.9 (Not yet released, Beta)

This section documents all changes and bug fixes applied since the release of 5.1.8.

Bugs Fixed

• In Model View after performing Edit, Select, Select All, it was not then possible to undo the operation.(Bug #43225)

• When a script was processed by File, Import, Reverse Engineer MySQL CREATE Script, columns with aboolean data type had their data type ignored. As a result, the type of the column in the Table Editor wasempty. (Bug #43094)

Page 450: MySQL Workbench

Changes in Release 5.1

442

Changes in MySQL Workbench 5.1.8 (Not yet released)

This section documents all changes and bug fixes applied since the release of 5.1.7.

Bugs Fixed

• In the Reverse Engineer Database wizard it was not possible to select only one table to reverseengineer, and then proceed to the next step. (Bug #45881)

• Using the Inserts Editor caused MySQL Workbench to crash. The error message generated when usedwas:

** Message: ==============================** Message: refresh_gui_becb unhandled refresh: 20 RefreshTimer

This was due to the fact that, in the 5.1.4 Alpha version of MySQL Workbench, the Inserts Editor had notbeen implemented. (Bug #40671)

Changes in MySQL Workbench 5.1.7 (Not yet released)

This section documents all changes and bug fixes applied since the release of 5.1.6.

Bugs Fixed

• MySQL Workbench 5.1.7 for Mac OS X crashed at startup. It was looking for libmysqlclient.15,which was not found in /usr/local/mysql/lib. The error generated was:

Process: MySQLWorkbench [14915]Path: /Applications/MySQLWorkbench.app/Contents/MacOS/MySQLWorkbenchIdentifier: com.sun.MySQLWorkbenchVersion: ??? (???)Code Type: X86 (Native)Parent Process: launchd [95]

Date/Time: 2009-02-02 18:53:52.120 +0100OS Version: Mac OS X 10.5.6 (9G55)Report Version: 6

Exception Type: EXC_BREAKPOINT (SIGTRAP)Exception Codes: 0x0000000000000002, 0x0000000000000000Crashed Thread: 0

Dyld Error Message: Library not loaded: /usr/local/mysql/lib/libmysqlclient.15.dylib Referenced from: /Applications/MySQLWorkbench.app/Contents/MacOS/MySQLWorkbench Reason: image not found

Note that MySQL was installed, but the specific version of client library required was not present. (Bug#42550)

Changes in MySQL Workbench 5.1.6 (Not yet released)

This section documents all changes and bug fixes applied since the release of 5.1.5.

Functionality Added or Changed

• MySQL Workbench has been changed so that layers and tables listed in the Layers palette are sorted inalphabetic order, making it easier to find the required object. (Bug #39781)

Bugs Fixed

• A dialog displayed a message with a missing file name. The message displayed was:

Page 451: MySQL Workbench

Changes in Release 5.0

443

Import of SQL script file '' has finished successfully.

Note the file name is missing from the message.

This dialog is located in the File, Import, Reverse Engineer SQL CREATE Script wizard. It is displayedon the page after importing the file, clicking Next and then Execute. (Bug #39922)

• The Advanced button displayed the text label &Advanced.

This button is located in the File, Import, Reverse Engineer SQL CREATE Script wizard. It is displayedon the page after importing the file. (Bug #39921)

Changes in MySQL Workbench 5.1.4 (Not yet released)

This section documents all changes and bug fixes applied since the release of 5.1.3.

Functionality Added or Changed

• There was a problem where relationships that were hidden could then not be selected to bring up theirrelationship editor. Relationships can now be selected as objects in the Layer window. Once selected,the relationship's visible property can be set to True in the Properties window, thus making therelationship visible again. (Bug #40167)

Bugs Fixed

• A model created using the Windows version of Workbench caused the Linux version of Workbench tocrash on loading the model. (Bug #39983)

• Loading a model using the Linux version of Workbench resulted in a crash. However, the model loadedcorrectly with the Windows versions of Workbench. (Bug #39992)

Changes in Release 5.0

Changes in MySQL Workbench 5.0.30 (18 February 2009)

This section documents all changes and bug fixes applied since the release of 5.0.29.

Bugs Fixed

• If a model contained a View that was using a Function, and an attempt was made to Synchronize thedatabase, an error was generated such as:

Error 1305: FUNCTION `bleble` does not exist

A similar error was also generated if the Forward Engineer SQL CREATE Script wizard was used.(Bug #40846)

• The Forward Engineer SQL ALTER Script wizard produced an erroneous script.

If Forward Engineer SQL CREATE Script was used to generate a script and this was then used as aninput to Forward Engineer SQL ALTER Script, without having made any changes to the model, then anALTER script with no changes should be produced. However, the ALTER script showed many changes,even though no changes had been made to the model. (Bug #37709)

• Introducing a UserType into a model caused the File, Export, Forward Engineer SQL CREATE Scriptwizard to crash. Further, performing a Plugins, Objects, Copy SQL to Clipboard operation also causedMySQL Workbench to crash. (Bug #42085)

Page 452: MySQL Workbench

Changes in Release 5.0

444

• MySQL Workbench crashed when the mouse wheel was used. If you scrolled the Options tab of theTable Editor, closed the Table Editor and then used the mouse wheel again on the MySQL Modelpage, MySQL Workbench crashed. (Bug #42847)

• The Forward Engineer SQL CREATE Script wizard failed to generate a script correctly.

This happened when using the File, Export, Forward Engineer SQL CREATE Script facility. If, in thewizard, Object of type MySQL table was selected, and then all tables added to the Exclusion Maskspane, before moving back the required table to the Objects to Process pane, the script was generatedfor the entire database rather than the selected table. (Bug #41475)

• When a diagram was renamed, the history displayed:

Rename 'new name' to 'new name

It should have instead displayed:

Rename 'old name' to 'new name'

(Bug #41355)

• The viewport, which is the combobox in the top right corner of Workbench, did not scale to less than40%. However, resizes above 40% worked fine. (Bug #39607)

Changes in MySQL Workbench 5.0.29 (12 December 2008)

This section documents all changes and bug fixes applied since the release of 5.0.28.

Bugs Fixed

• The table figures in the Diagram view had insufficient information. They did not display information suchas constraints or default values. (Bug #38553)

• When a diagram was renamed, the label of the corresponding tab was not automatically updated.However, when the focus was changed, the text was correctly updated. (Bug #38867)

• In the EER Diagram view an icon was not displayed for Not-NULL items. (Bug #41326)

• Workbench crashed when objects other than tables were moved out of a layer. (Bug #41358)

• When the grid was activated, dragged objects on layers were incorrectly placed with an offset of -1,-1.(Bug #35989)

• The last column in a table disappeared in the table editor, and it was not possible to add further columns.(Bug #35905)

Changes in MySQL Workbench 5.0.28 (06 December 2008)

This section documents all changes and bug fixes applied since the release of 5.0.27.

Bugs Fixed

• If two foreign keys were created in a table that referenced a second table and then an attempt was madeto delete the relations and the referenced table, MySQL Workbench crashed. (Bug #41025)

• When clicking the + and - buttons in the Physical Schemata pane of the MySQL Model tab, anUnhandled Exception was generated:

Page 453: MySQL Workbench

Changes in Release 5.0

445

System.Runtime.InteropServices.SEHException: External component has thrown an exception.

(Bug #40971)

• A complex EER diagram threw an exception whenever an action was performed on it. However, otherdiagrams in the same MWB file functioned correctly.

The exception generated was:

System.Runtime.InteropServices.SEHException: Un composant externe a levé une exception. à wb.ModelViewForm.handle_mouse_button(ModelViewForm* , MouseButton , Boolean , Int32, Int32 , EventState ) à MySQL.Workbench.ModelViewForm.OnMouseUp(MouseEventArgs e, Int32 X, Int32 Y, Keyskeystate, MouseButtons buttons) à MySQL.GUI.Workbench.ModelViewForm.CanvasPanel_MouseUp(Object sender, MouseEventArgse) à System.Windows.Forms.Control.OnMouseUp(MouseEventArgs e) à MySQL.Utilities.WindowsCanvasViewerPanel.OnMouseUp(MouseEventArgs e) à System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32clicks) à System.Windows.Forms.Control.WndProc(Message& m) à System.Windows.Forms.ScrollableControl.WndProc(Message& m) à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) à System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam,IntPtr lparam)

(Bug #39360)

• If you attempted to select several tables in the table list of the MySQL Model view, and you accidentallyincluded the Add Table button in your selection, a message box appeared warning of an unknownexception:

"Unknown Exception caught in: c:\documents and settings\mysqldev\my documents\visualstudio 2005\projects\workbench\backend\windows\wb.wr\src\Wb.h at line 1010"

The program did not crash. Only the messagebox appeared. (Bug #41201)

• The Referenced Column pane of the Foreign Key tab became cleared if the foreign key was renamed.Subsequently, attempting to choose a Referenced Column did not display a link in the EER Diagramview. To get foreign key relationships working again it was necessary to de-select the check boxes fromthe Columns pane, re-select them, and then select the Referenced Column pane. (Bug #40649)

• When a table was renamed the inserted data was lost. (Bug #40327)

Changes in MySQL Workbench 5.0.27 (07 November 2008)

This section documents all changes and bug fixes applied since the release of 5.0.26.

Functionality Added or Changed

• There was a problem where relationships that were hidden could then not be selected to bring up theirrelationship editor. Relationships can now be selected as objects in the Layer window. Once selected,the relationship's visible property can be set to True in the Properties window, thus making therelationship visible again. (Bug #40167)

Bugs Fixed

• The Copy SQL to Clipboard action (right-click menu on table) did not use Windows-compatible lineendings. (Bug #39476)

Page 454: MySQL Workbench

Changes in Release 5.0

446

• If a trigger was renamed, and the design then synched with a database instance, the generated SQLcreated a trigger with the new name and then dropped the trigger with the old name. This resulted in thiserror:

Error 1235: This version of MySQL doesn't yet support'multiple triggers with the same action time and event for one table'

(Bug #39989)

• When a column had a data type BOOLEAN and it was exported using Forward Engineer SQL ALTER, theexported type was BOOLEAN(2) instead of BOOLEAN. (Bug #39257)

• When a stored routine was edited, the edit cursor jumped back to the start of the page unless typing wasconstant. (Bug #40426)

• When a DBDesigner model with 333 tables was imported into Workbench the RAM usage went up toapproximately 1GB. Workbench then crashed with this exception:

Error creating cairo context: out of memory

(Bug #37178)

• Workbench application performance was poor, with slow loading times and excessive memory usage.(Bug #38439)

• When using the Copy Insert to Clipboard menu item the generated SQL code was incorrect. The “S” wasmissing from “VALUES” and the data was not included. This resulted in SQL code such as:

INSERT INTO `table1` (`table1_id`, `descr`) VALUE ();

(Bug #40041)

Changes in MySQL Workbench 5.0.26 (16 October 2008)

This section documents all changes and bug fixes applied since the release of 5.0.25.

Bugs Fixed

• The script generated by the Export, Forward Engineer SQL CREATE Script menu item contained invalidstatements when using two schemata. (Bug #39211)

• Exported SQL code containing a trigger that called a procedure would fail when an INSERT activated thetrigger. (Bug #39088)

• When attempting to export a model using the File, Export, Forward Engineer SQL CREATE Script menuitem, Workbench crashed on clicking the wizard's Finish button. (Bug #39578)

• Renaming a table and then selecting Forward Engineer SQL ALTER Script did not result in a RENAMEstatement. Instead, DROP and CREATE statements were generated. (Bug #39256)

• The Copy Insert to Clipboard action generated SQL with lowercase keywords. This was not consistentwith the behavior of the Copy SQL to Clipboard action. (Bug #39477)

Changes in MySQL Workbench 5.0.25 (12 September 2008)

This section documents all changes and bug fixes applied since the release of 5.0.24.

Bugs Fixed

Page 455: MySQL Workbench

Changes in Release 5.0

447

• In the Foreign Key tab of the Table Editor, the menu that is displayed on clicking in the ReferencedTable column, listed table names by creation date, rather than by sorted name. (Bug #38944)

• When you loaded a UTF-8 encoded script file into Workbench, the embedded SQL editor replacedinternational characters with the ? symbol. (Bug #38783)

• If any DEFAULT properties were defined for a model, they appeared to be lost after saving the model andrestarting Workbench. (Bug #38825)

• Forward Engineer SQL CREATE Script and Forward Engineer SQL ALTER Script generated scripts thatdid not put index names in quotation marks. (Bug #39140)

• When Workbench was started with the GRT Shell tab opened, the object tree in the GRT Tree pane wasnot displayed. (Bug #39122)

• Foreign keys referencing a deleted table were not removed. (Bug #39150)

• The Triggers tab would always enable Insert mode when opened. (Bug #39118)

• If the user closed all tabs and then quit, Workbench crashed. (Bug #39346)

• When triggers were exported with the Generate DROP TABLES statements option checked, DROPTRIGGER IF EXISTS did not appear in the exported SQL. (Bug #39119)

• When creating Views and Routines, the entry in the Undo History window showed “Parse MySQL View”instead of “View Created”, and “Parse MySQL Routine” instead of “Routine Created”.

When subsequently undoing this operation the correct text was displayed. Performing a redo thenresulted in the incorrect text being displayed again.

Additionally, when undoing a Routine Group, the previous undo action in the history was incorrectlyrenamed and the last entry in the history was deleted. (Bug #36047)

• In the Table Editor tab, wherever data could be entered, such as in the Foreign Key Name entry field,the default wrap protocol was to go to a new line. This resulted in text that was only partially visible. (Bug#34510)

• The synchronization wizard could show a diff tree for schemata different from those that had beenselected. (Bug #32365)

Changes in MySQL Workbench 5.0.24 (12 August 2008)

This section documents all changes and bug fixes applied since the release of 5.0.23.

Functionality Added or Changed

• In the MySQLGrtShell.exe program the Values tab has been renamed to GRT Tree. However, theGRT Tree tab only shows a root node because there is no GRT Tree loaded when the Shell is startedin standalone mode. (Bug #35052)

Bugs Fixed

• Indexes listed when the Index tab was selected could not be deleted if the index type was FOREIGN.(Bug #38639)

• When the menu item Model, Validation, Validate all was selected, and an error dialog subsequentlydisplayed, the dialog error message had a missing dot separator between the database name and tablename. (Bug #38632)

Page 456: MySQL Workbench

Changes in Release 5.0

448

• It was not possible to synchronize a model to an external database, if the model contained triggers. (Bug#38436)

• Errors were generated in SQL code during Forward Engineer Schema for Inserts data in TIMESTAMPcolumns. (Bug #37059)

• When synchronizing the database, table comments were not updated. However, column commentsworked as expected. (Bug #37686)

• Workbench crashed when using the Model, Validation(MySQL), Validate All menu item on a model thatcontained a dangling foreign key index. (Bug #38115)

• When resizing the comment column under Physical Schemata view in column format, the columnresize was reverted when switching between schemas. (Bug #38431)

• When a DBDesigner 4 XML file was imported into Workbench the INSERT statements were incorrectlyconverted. (Bug #38196)

• An attempt to copy a table and then paste it into a new schema resulted in an Unknown Exceptionbeing generated. (Bug #38429)

• When a DBDesigner 4 model that contained duplicate relationships was imported into Workbench, andthen exported, the resulting script would fail when executed on MySQL server. (Bug #38488)

• Importing a script that specified an incorrect data type required Workbench to close. (Bug #38146)

• Database, Synchronize did not update the model view when the table was changed in the database, untilafter Workbench was restarted. (Bug #37634)

• Forward Engineer SQL CREATE Script did not reflect changes made to the model. (Bug #37574)

• In the mysql-workbench-oss-5.0.23-win32-noinstall version of Workbench the menu itemPlugins, Objects, Copy SQL to Clipboard did not work. (Bug #37736)

• When using the Forward Engineer SQL CREATE Script, columns marked as NOT NULL were generatedas NOT NULL DEFAULT NULL. (Bug #37385)

• If you created a new view with an OR REPLACE clause, the Forward Engineer SQL CREATE Scriptoutput contained the OR REPLACE clause twice. (Bug #38337)

• Foreign key options (onDelete, onUpdate) are not imported from DBDesigner schema. (Bug #37794)

• Running Help, Update... crashes Workbench when the wizard comes to the point where it is trying toclose Workbench. (Bug #37665)

• The auto-increment flag was not cleared internally for a column, when the type of that column waschanged to one for which auto-increment is invalid; for example, char. When the model was exportedusing Export, Forward Engineer SQL Create Script, the resulting script incorrectly retained the auto-increment flag for the changed column. (Bug #36085)

• If a database was imported using Reverse Engineer SQL ALTER Script and the database namechanged in Workbench, the script then generated by Forward Engineer SQL ALTER Script wasincorrect. (Bug #36178)

Changes in MySQL Workbench 5.0.23 (25 June 2008)

This section documents all changes and bug fixes applied since the release of 5.0.22.

Functionality Added or Changed

Page 457: MySQL Workbench

Changes in Release 5.0

449

• It was not clear how a stored connection profile could be edited and the changes saved. Tooltips havebeen added to the relevant buttons and the main documentation clarified. (Bug #37061)

Bugs Fixed

• The Forward Engineer wizard did not report connection status correctly. If invalid database credentialswere entered, the wizard reported success, even though the connection failed. (Bug #37060)

• Using Generate Schema Diff Report resulted in a crash. The crash was caused by improper handling ofan invalid foreign key in a table. While this issue is correctly reported by a validation module, in StandardEdition Generate Schema Diff Report didn't handle that correctly. (Bug #37393)

• When a new column was added to a table Inserts data was deleted. (Bug #37192)

• Workbench was failing to correctly export Trigger DDLs. (Bug #37432)

• If you try to place a new image into an EER Diagram and select an invalid filetype, you get a errormessage dialog with the following text:

cairo error: invalid matrix (not invertible)

If you then click OK to clear the dialog and then try to select Place a New Table, the error messagedialog is displayed again. (Bug #37079)

• Trying to edit a table in a new window displays an error message dialog:

plugin:wb.edit.editSelectedInNewWindowInvalid pluginInvalid plugin wb.edit.editSelectedInNewWindow

(Bug #37180)

• The script generated by the File, Export, Forward Engineer SQL ALTER Script menu item containssyntax errors. (Bug #36889)

• Incorrect behavior when editing a table. When the columns tab is selected, if you want to delete multipleselected tables at once, Workbench removes the wrong columns. (Bug #37045)

• The File, Export, Forward Engineer SQL CREATE Script menu item exports a script it is then unable toimport using the File, Export, Reverse Engineer MySQL Create Script menu item because it incorrectlyimports comments containing special characters. (Bug #37563, Bug #37562)

• Performing a Database Synchronization resulted in erroneous ALTER statements being generated. (Bug#34812)

• Menu item was incorrectly named Generate Schema Diff Report, when it should have been calledGenerate Catalog Diff Report. (Bug #34398)

• Workbench generated incorrect syntax when attempting to synchronize with a live server. The resultingcode was missing commas which resulted in a syntax error. (Bug #36674)

• The behavior of the Synchronize wizard was inconsistent when cancelled and re-run. (Bug #36177)

• When creating a Schema Diff Report from the local model to a live database, the wizard crashedwith an unhandled exception. (Bug #35878)

• Workbench failed to restore window states, window positions and side-panel sizes from the previousexecution of the application. (Bug #32442)

• Mouse wheel does not work when you double-click a table and select the Options tab. (Bug #36374)

Page 458: MySQL Workbench

Changes in Release 5.0

450

• Collapsing of the EER Diagram section of the MySQL Model tab is not retained after program relaunch.(Bug #35717)

• In the MySQL Model tab, in the summary line for Physical Schemata, there are three icons, one forlarge icon view, one for small icon view, one for list view. Changing the view is not saved betweenapplication launches. (Bug #35716)

• Several windows and tabs have fields which are either not completely visible or are obscured by labelsthat overlap the field. (Bug #36115)

• When File, Export, Forward Engineer SQL ALTER Script menu item is selected it causes an ALTERScript Generation (Script Synchronization) error. (Bug #36355)

• After reverse engineering an SQL create script and drawing some EER diagrams, a subsequent importof the same script destroys the EER diagrams. All tables in the catalog are updated, but the reference ofthe table in the diagram to the table in the catalog is lost. The tables in the diagram are still visible, butdo not correspond to the table in the catalog.

After closing and re-opening the file, all diagrams are empty and it is impossible to delete the diagrams.However, in the overview in the upper right corner, the tables placed in the diagram are still visible. (Bug#36381)

• The export filter did not properly filter tables. (Bug #36739)

• The AUTO_INCREMENT attribute is now ignored on import for column types that do not support it. (Bug#31986)

Changes in MySQL Workbench 5.0.22 (27 May 2008)

This section documents all changes and bug fixes applied since the release of 5.0.21.

Bugs Fixed

• When columns are added to, or removed from a table, Workbench deletes all Inserts data. (Bug#37008)

• Can not add values for TIMESTAMP columns in the Inserts editor. (Bug #37009)

• When opening a model created with an earlier version of Workbench, the Indexes tab displayed indexesof type FOREIGN as type INDEX, and it was not possible to change them back to FOREIGN. (Bug#36453)

• The script generated by database synchronize contained errors. (Bug #35644)

• The script generated by the File, Export, Forward Engineer SQL CREATE Script menu item contains aspurious quotation mark. (Bug #36753)

• The Copy to SQL operation caused a crash. (Bug #36184)

• The enabled/disabled status of items in the Edit menu was not updated properly. (Bug #35962)

• Relationships were drawn over tables. (Bug #35867)

• View renaming in overview did not work properly and has been disabled. (Bug #36202)

• Dragging objects out of a layer did not work properly. (Bug #36053)

• Setting up foreign key relationships across multiple schemas did not work. (Bug #34546)

Page 459: MySQL Workbench

Changes in Release 5.0

451

• Scrollbars now appear correctly when editor windows are reduced in height. (Bug #32454)

• Trigger definition auto-formatting resulted in malformed code. (Bug #36815, Bug #37685)

• For CREATE TABLE statements, TIME column default values were not quoted properly. (Bug #36669)

• Print preview in landscape orientation did not work correctly. (Bug #36647)

• If a table column definition permits NULL and has been set with a default of NULL, integrity validationoperations complained that the default value for the column is invalid. (Bug #36397)

• After use of Control+X to cut text from a text-edit box and Control+Z to undo the operation, the canvaswas updated correctly but not the text box. (Bug #36358)

• Shifted content could not be scrolled or navigated. (Bug #36328)

• The mousewheel scrolled the overview pane when it was open behind the insert-editor. (Bug #36253)

• Table partitioning information was not exported properly. (Bug #32226)

Changes in MySQL Workbench 5.0.21 (27 April 2008)

This section documents all changes and bug fixes applied since the release of 5.0.20.

Bugs Fixed

• When a schema used InnoDB, and then was switched to use MyISAM, the script generated by ForwardEngineer SQL CREATE Script still contained InnoDB-only syntax. (Bug #35947)

• The undo operation did not completely undo a relationship between two tables. It removed only the linedrawn between two tables, but did not undo the fields and keys. (Bug #36645)

• Forward Engineer wizard failed to create a table, but did not show any error messages. (Bug #35874)

• The Copy Connection nn menu item on the context menu of a connection does not have acomplementary Paste Connection menu item. The Edit menu has a greyed-out Paste Connection menuitem. (Bug #36166)

• The scripts generated by the File, Export, Forward Engineer SQL ALTER Script and File, Export,Forward Engineer SQL CREATE Script include unnecessary SQL code. (Bug #36170)

• When making a column a primary key and this column has NULL as default value, this default value isnot changed. When the table gets synchronized back to the database Workbench creates a statementsuch as:

ALTER TABLE `test_defhan`.`table1` CHANGE COLUMN `id_table1` `id_table1` INT(11) NOT NULLDEFAULT NULL, ...

This leads to an error:

Error 1067: Invalid default value for 'id_table1' (Bug #32972)

• Saving a file restores the column widths of the list view to default under Physical Schemata. (Bug#35718)

• Double-clicking a column-heading separator in Find results caused a crash. (Bug #36266)

Changes in MySQL Workbench 5.0.20 (26 April 2008)

This section documents all changes and bug fixes applied since the release of 5.0.19.

Page 460: MySQL Workbench

Changes in Release 5.0

452

Bugs Fixed

• The message log on the Forward Engineer Progress/Results Advanced dialog had no scroll bar. (Bug#36192)

• Re-creating a deleted relationship caused a crash. (Bug #36385)

Changes in MySQL Workbench 5.0.19 (15 April 2008)

This section documents all changes and bug fixes applied since the release of 5.0.18rc.

Bugs Fixed

• Forward Engineer SQL CREATE Script wizard generated no output script. Further, no error or warningmessages appeared to be generated that might explain this.

The error message in this case was displayed in the Advanced Log, which was not visible to the user.MySQL Workbench was changed so that the Advanced Log appeared to the user if it received an errormessage. (Bug #34430)

• The HTML Basic Single Page DBDoc report from the Model -> DBDoc -> Model Reporting menu optionwas missing the schema and table numbers. (Bug #36060)

Changes in MySQL Workbench 5.0.18rc (not released)

This section documents all changes and bug fixes applied since the release of 5.0.17rc.

Functionality Added or Changed

• Foreign key labels could not be hidden, and displayed labels were not centered. There are now optionsto hide all connection captions, and to center captions. (Bug #30902)

Bugs Fixed

• If a table in an EER Diagram was double-clicked in an attempt to open it for editing in the Table Editor,this error was generated:

Cannot load selected plugin(.\db.mysql.editors.wbp.fe.dll::DbMysqlTableEditor)

(Bug #35897)

• Workbench is unable to read files such as Workbench Model Files from a non-English directory. (Bug#35547)

• Synchronizing the data model with a live database from the SQL Diff Tree dialog resulted in a crash.(Bug #35884)

• The Pack Keys option could not be saved. (Bug #35872)

• Some menus or submenus had items enabled when the corresponding features were disabled. (Bug#35870)

• The Connection Caption option did not work properly. (Bug #35859)

• The status of a connection line in a table diagram was not updated when a foreign key relationshipbetween tables was changed. (Bug #35800)

• The File -> Export -> Export as PNG menu item was enabled under some circumstances in which itshould have been disabled. (Bug #35746)

Page 461: MySQL Workbench

Changes in Release 5.0

453

• Scrolling was slow for table models with large numbers of tables. (Bug #35655)

• Workbench permitted table comments to be entered longer than the maximum length of 60 characters.(Bug #34507)

• Autoplacing for display of complex schemas has been improved. (Bug #32888)

• In the table editors foreign key Tab, when a column for the foreign key is checked (right pane), theReferenced Column dropdown opens. Pressing Escape at this point caused a crash. (Bug #35926)

• After changing the Row Format option, closing the table editor and opening a new document caused acrash. (Bug #35925)

• Pressing Control+Z to undo the last change in an SQL Script text box deleted the entire script. (Bug#35649)

• The Reference Column dropdown used during foreign key creation was slow to display. (Bug #35948)

• A crash could occur during foreign key creation. (Bug #33545)

• In the table editor, setting the input focus by clicking the mouse did not work. (Bug #35969)

• Creating a Schema Diff Report from the local model to a live database caused a crash. (Bug #35878)

• Typing q in the GRT Shell caused a crash. (Bug #32755)

Changes in MySQL Workbench 5.0.17rc (07 April 2008)

This section documents all changes and bug fixes applied since the release of 5.0.16rc.

Bugs Fixed

• The font for views and routines was not monospace by default. (Bug #34537)

• When modifying an existing foreign key relationship, the generated ALTER script did not reflect themodification. (Bug #35265, Bug #35830)

• Opening a GRT shell while the table editor is open would raise an exception. (Bug #35349)

• Workbench would crash repeatedly when drawing the diagram for a table where the referenced columnin a foreign key relationship was blank. (Bug #35677)

• When creating foreign key relationships that point to more than one table, the same foreign key identifierfor the same table could be created. This would create invalid SQL code for creating the table. (Bug#35262)

• When adding a foreign key relationship within a catalog with an existing entity relationship diagram, theforeign key relationship is not added to the existing diagram. (Bug #35429)

• Identifiers for field names in DML SQL statements would not be quoted correctly, permitting reservedwords to be included in the SQL statements. (Bug #35710)

• When importing an existing DB Designer schema, Workbench could crash. (Bug #35123)

• Opening an existing Workbench model with an invalid foreign key definition would cause an exception.(Bug #35501)

• Editing a stored procedure within Workbench could cause an exception. (Bug #35828)

• The modified timestamp for an existing model was not correctly updated for all changes. (Bug #35719)

Page 462: MySQL Workbench

Changes in Release 5.0

454

• Editing the text of the Trigger portion of an existing schemata would introduce additional text into theTrigger definition. (Bug #34397)

• Identifiers using uppercase characters for stored procedures would automatically be modified tolowercase. (Bug #35650)

• When moving more than layer in Model Navigator, only the first layer's position would be reflectedcorrectly in the output. (Bug #33627)

• Selecting Export, Forward Engineer ALTER script from the File would open a SQL ScriptSynchronization dialog, rather than export dialog. (Bug #34099)

• Creating more than five stored procedures or views in a model would cause the dialog box for theoperation to move to a different layer, making it inaccessible when using the mouse. (Bug #34153)

• When using the Hide Menu Items Not Applicable to this Edition option, a simplified version of theFind dialog box was not available. (Bug #34493)

• Setting up indexes in both the index and foreign key list views, the mouse pointer would dissappearwhile the entry box was in use. (Bug #35062)

• Modifying the primary key index definition for within the table view would not update the entityrelationship diagram. (Bug #35639)

• Deleting an existing layer on a diagram and then editing other objects on the same canvas couldgenerate a number of exceptions, and could corrupt the Workbench file. (Bug #35603)

• Switching to the Connect to Columns notation with an existing model would cause an exception. (Bug#35601)

• When validating an existing model using the Forward Engineer Wizard, MySQL-specific validation wouldfail. (Bug #35604)

• When using the Forward Engineer Wizard, if an error occurred, the dialog showing the error detailwould be incomplete, and determining the reason for the error would be masked because the end of logmessage would be hidden. (Bug #34509)

• Moving multiple tables on the same diagram, and then using Undo to revert the model to the originallayout, only the first table selected be returned to its original position. (Bug #35465)

• Data in BLOG and TEXT columns defined using the Inserts tab would not be quoted correctly in theresulting SQL. (Bug #35525)

• The Model Navigation window could not be collapsed like other palettes. (Bug #35642)

• When working with the SQL Script editor, it was not possible to select all the text in the display whenusing Control+A. (Bug #35646)

• The precise position of individual connections would not be retained when the schema was saved. (Bug#35397)

• Creating a new view and then deleting it caused a System.AccessViolationException. (Bug#35840)

• Double-clicking the Catalog title bar undocked the GRT Tree window. (Bug #34856)

Changes in MySQL Workbench 5.0.16rc (26 March 2008)

This section documents all changes and bug fixes applied since the release of 5.0.15rc.

Page 463: MySQL Workbench

Changes in Release 5.0

455

Functionality Added or Changed

• Options and configuration options that affect models can now be set on a model by model basis. ChooseOptions from the Model menu and choose the Diagram tab. (Bug #34610)

Bugs Fixed

• A 1:m relation in a diagram would fail to be generated properly when exported as a PDF. (Bug #32882)

• The Undo and Redo options would not be applied properly when making modifications to partitiondefinitions. (Bug #32279)

• When double-clicking the row in a column as a primary key, the primary key property would be toggled.The editor will now permit you to edit the value when you click a data row on the table. (Bug #35613)

• When disabling global options on an individual model would fail to honor the model specific optionswould be ignored. (Bug #35516)

• Placing an image on to the canvas could crash the application. For images larger than the canvas, theimage is automatically reduced so that it is properly visible on the canvas for editing. (Bug #33179)

• Opening the Indexes portion of a table would generate a unhandled exception error. (Bug #35598)

• When placing a 1:n relation, an index out of range error could be raised. This could further resultin operation on NULL object: Invalid value errors when trying to edit the relation. (Bug#35447)

• Printing an HTML version of the schema would produce a fatal error. (Bug #35400)

• Setting the value of a numeric column to a negative value was not supported. (Bug #35442)

• The OK and Cancel buttons for the Diagram Size dialog would not be initialized properly. (Bug #34808)

• When copying multiple table definitions from one schema to another, only the first table in the selectionwould be pasted into the new schema. (Bug #34483)

• When exporting a diagram to PDF, some additional lines would be added to the generated PDF. (Bug#33586)

• The Draw Line Crossing option would fail to be recognized correctly. You can also now set this on anindividual model basis using the Options option in the Model menu. (Bug #34248)

• Copying an existing module to the plugins directory would trigger a double registration of the modulem,and produce an error. (Bug #34134)

• When using print preview on a diagram, clicking the Print button would send a blank page to the printer.(Bug #34630)

Changes in MySQL Workbench 5.0.15rc (17 March 2008)

This section documents all changes and bug fixes applied since the release of 5.0.14abeta.

Bugs Fixed

• Editing a primary key column within a model on Microsoft Vista could cause a crash. (Bug #34922)

• When editing a model, the windows and toolbars would realign themselves during selection. This wasrelated to the configured font sizer the DPI setting of the monitor, causing the application to redraw thewindows to account for the configuration combination. (Bug #34822)

Page 464: MySQL Workbench

Changes in Release 5.0

456

• Generating an ALTER SCRIPT or using the synchronize functionality on a model with entityrelationships, the relationship lines within the diagram would be generated twice. (Bug #35213)

• When editing comments, the Return key would move to the next column, which prevented the use ofnewlines within the comment information. Workbench now permits use of the Return key within thecomment field. (Bug #33980)

• Deleting an existing schema with an open table editor would not close the table editor window. Thewindow is now closed when the schema is deleted. (Bug #34345)

• Editing an existing diagram could cause an unhandled exception on Windows Vista. (Bug #33477)

• When scrolling through a schema, the tables in the schema were not redrawn correctly. (Bug #32835)

• Deleting objects within the overview pane when the corresponding editor pane for those objects is openwould cause a crash. (Bug #35186)

• When changing the name within a foreign key relationship, the modified name is not reflected in thetables to which the foreign key is related. (Bug #35093)

• When saving an existing model, the MySQL Model overview panel would scroll to the top of the modeldefinition. (Bug #34975)

• Boolean values were unsupported when trying to insert values into a table, the TRUE would instead bereplaced by a textual, quoted version 'TRUE'. (Bug #35205)

• The New File dialog is nonmodal, and could be hidden by other windows. The dialog is now alwaysdrawn on top of other windows. (Bug #34784)

• Creating a new file after changing an existing file with modifications could lead to the original beingdeleted without prompting to save the changes. (Bug #34976)

• Changing the column name of a table when you have pending inserts to the table did not change thecolumn name in the corresponding INSERT statements. (Bug #34500)

• Printing a model diagram to PDF or Postscript, results in a corrupt file PDF or Postscript file that doesnot match the model. (Bug #35197)

• A foreign key relationship to the source table (a reflexive relationship) gives a bad representation in theentity model diagram. (Bug #35237, Bug #34810)

• Printing a model when there is no printer connected could result in an application exception. (Bug#32320)

• Opening an existing MySQL Workbench file after associating the .mwb extension with the applicationleads to a crash when you open a MySQL Workbench file. (Bug #34849)

• A new GRT Inspector tab would be created every time the GRT Shell was opened. In addition,manually closing the GRT Inspector and GRT Shell components would cause an exception. (Bug#34857)

• Incorrect ALTER statements are created during the synchronization process if you add foreign keys to anexisting or imported model. (Bug #34897)

• When entering data into the Default column of the table editor, the use of the Return key for saving theinformation about the default value was not supported. (Bug #35127)

• Using Undo on a relationship within a model would cause an exception. (Bug #35243)

Page 465: MySQL Workbench

Changes in Release 5.0

457

• Identifiers (tables, column, index, triggers and other data types) could be created with names longer thanthe maximum support by MySQL Server. (Bug #33265)

• Placing an object on the canvas of an EER diagram where you have reverse engineered an existingdatabase, would lead to multiple copies of the object appearing on the diagram. (Bug #32891)

• There was a typographical error in the help message for the GRT command cd. The word Absolutewas missing the final e. This has been corrected. (Bug #35119)

• Searching a project specifying Entire Model in the In Location: list did not return any results. Thisapplied to the Standard Edition only. (Bug #34170)

• When the page size was changed from A4 to B4 it was not possible to move objects on an EER diagrambeyond the old page boundaries. (Bug #34148)

• Where relationship lines crossed, and one of the connectors was changed to Hidden or Draw Split,the semi circle that indicated the previous intersection was still shown on the remaining connector. (Bug#33818)

• On an EER diagram you could not select a relationship if the connection line wasn't stepped. You cannow select a connector even if it is not stepped. (Bug #32734)

• The application crashed when attempting to export an SQL CREATE script. (Bug #33263)

• The Properties palette was not cleared when a new project was started. It retained the properties ofthe last selected object. (Bug #34433)

• Attempting to move a table on an EER diagram after deleting a relationship, caused the application tocrash. (Bug #34816)

• After importing a DB Designer schema, the following error occurred: "Cairo error: input string not validUTF-8." (Bug #34987)

• Scrollbar navigation did not work after importing a DB Designer schema with a large canvas size.However, you could still navigate using the Model Navigator palette. (Bug #34988)

• On the MySQL Model page, when the large icons view was selected, the Add Table icon disappeared.(Bug #34904)

• Changing the drawSplit property of a connection from the Properties palette did not updated theVisibility section of the connection editor. (Bug #34934)

Changes in MySQL Workbench 5.0.14abeta (28 February 2008)

This unscheduled beta release fixes bug#34847. Other bug fixes applied since the release of 5.0.14betaare also documented.

Bugs Fixed

• MWB files were not saved properly if Workbench crashed. Reopening such files caused Workbench tocrash. (Bug #34848)

References: See also Bug #34847.

• Workbench models created in version 5.0.13 crashed when used with version 5.0.14. The unscheduledBeta release, 5.0.14a fixes this bug. (Bug #34847)

• Importing a DBDesigner file immediately threw an exception. This happened even when softwarerendering was used. DBDesigner files can now be imported without incident. (Bug #33588)

Page 466: MySQL Workbench

Changes in Release 5.0

458

• Repeatedly changing the object notation crashed Workbench. This is no longer repeatable. (Bug#34499)

• When clicking the Browse button in the image editor, the default file name was openFileDialog1. Thisnow defaults to an empty string. (Bug #34622)

Changes in MySQL Workbench 5.0.14beta (25 February 2008)

This section documents all changes and bug fixes applied since the release of 5.0.13beta.

Workbench Improvements in this Version

• The GRT inspector has been improved to support new types. Namely:

• text

• longtext

• bool

• color

• file

This makes it much easier to change object properties manually. Multiple selection support has alsobeen improved—you can easily change a value for several selected objects at once.

• Because of serious performance and display issues Workbench no longer uses Mesa. For those userswho don't have native OpenGL support, Workbench now uses the Windows GDI API. The command lineswitch for using this mode is -swrendering. For more information about running Workbench from thecommand line see Launching MySQL Workbench on Windows.

• An Export as SVG menu option has been added under the File, Export menu option.

• A System Information menu option has been added to the Help menu. This option displays informationabout your system that is useful when reporting a big.

• A Fit Objects to Contents option has been added under the Arrange menu option. This option expandsan object on an EER diagram. For example, if a table has a long column name that is not fully displayed,using this menu option will expand the table making the column name visible.

• Expand All and Collapse All menu options have been added under the Arrange menu. The Expand Alloption expands all objects on an EER. This option will display a table's columns if the object notationsupports expansion. Indexes will not automatically be expanded unless they were previously expandedand have been collapsed using the Collapse All menu option. Some object notations, such as Classic,do not permit expansion or contraction. Collapse All undoes the operation performed by Expand All.

Bugs Fixed

• After placing related tables on an EER diagram and then removing them using the Undo menu option,the connection lines between related tables no longer showed up. (Bug #34601)

• When exporting an SQL CREATE script it was possible to create two tables in the same schema with thesame name. (Bug #34668)

• It was not possible to drag or resize tables on an EER diagram. Tables can now be manually resized.To revert a table to automatic sizing use the Property palette and set manualSizingto True. (Bug#32549)

Page 467: MySQL Workbench

Changes in Release 5.0

459

• It was not possible to resize a table that used the Workbench (Default) object notation. This wasproblematic for a number of reasons:

• Long table names make the table very wide.

• Column definitions that are long relative to the table name, are truncated.

• Even if you trimmed column names using the Diagram tab of the Workbench Options the nameswere sometimes truncated bled over the table border.

This has been corrected. (Bug #32981)

• When there were two schemata and two EER diagrams tables did not show up on the EER diagram iftables from different schemata were added to different EER diagrams. This was caused by defectivesoftware rendering. (Bug #32588)

• When there were many tables on an EER diagram, constant screen refreshing made the applicationunusable. The performance of the software rendering mode has been improved. (Bug #33646)

• Setting a column to AUTO_INCREMENT caused the application to crash. (Bug #34418)

• A table with many columns did not display properly. When the table was expanded on an EER diagramit was impossible to scroll down and view all the columns. Improved rendering has helped solve thisproblem. However, for very large tables you may have to increase the size of an EER. To do this use theModel, Diagram Size ... menu option. (Bug #33367)

• When a table's expanded property was set to 0, the connection line between related tables, appeared ata diagonal orientation. A connection line is now docked on the sides of a table even when the expandedproperty is set to 0. (Bug #34249)

• It was reported that you could not add a primary key to a table imported from a MySQL CREATE script.This was not true but did highlight the fact that the method for adding a primary key was not obvious.Now, in addition to adding a primary key by double-clicking the icon to the left of a column in the tableeditor view, you can also add a primary key by checking the PRIMARY KEY check box in the ColumnDetails section of the table editor. (Bug #34408)

• If there was a relationship between table A and table B and also one between table B and table A, theconnection lines appeared on top of each other. Connection lines now appear attached at the relatedcolumns. (Bug #34543)

• When choosing the Export as PNG menu option the file dialogue box file type was All Filesinstead ofPNG. The same was true for Export as singlePage PDF and Export as singlePage PS. The default is nowthe appropriate file type. (Bug #34548)

• When there were multiple tables with long identifiers the Physical Schemata section of the MySQLModel page was messy. Table names were obscured and sometimes overlapped. Also, the position ofthe Add Table icon was not optimal. Now the space between table names is adjusted to the largestentry and the Add Table icon is fixed in the upper left corner. (Bug #34536)

• When forward engineering to a live database, objects not selected on the Select Objects page werestill created. This applied to tables, routines, and users. (Bug #32578)

• When returning to the SQL Export Filter page after using the Back button, filters were no longerselected. Selections now persist. (Bug #34503)

• The export filters were applied more than once when forward engineering an SQL CREATE script. Thishappened if you exported the script after using the Back button on the SQL Export Filter page.(Bug #34501)

Page 468: MySQL Workbench

MySQL Utilities Change History

460

• Creating a new foreign key did not update an EER diagram. An EER diagram is now updatedimmediately. (Bug #34206)

• When multiple objects on an EER diagram were selected and deleted, Workbench crashed. Thishappened when both connections and tables were selected. (Bug #34434)

• Users failed to be created when exporting an SQL CREATE script. (Bug #34342)

• Copying a table from the MySQL Model page to an EER diagram canvas created a duplicate table withthe same name as the original. This table did not show up in the Catalog palette or in the appropriateschema in thePhysical Schemata section of the MySQL Model page. (Bug #34230)

• When changing the foreign key column of a table on an EER diagram, the foreign key did not changecolor and Workbench crashed when attempting to save the MWB file. The application no longer crashesand the foreign key is updated. (Bug #33139)

• When the object notation was Workbench Classic the width of a table on an EER diagram could notbe less than the widest column. If there was an enum column with many options, this made for adisproportionately wide table. Table width can now be less than the widest column. (Bug #34496)

• When using the menu option Generate Schema Diff Report an exception was thrown. A new tree-lessversion of the Diff report plugin resolves this problem. (Bug #34396)

• The display turned black when the application was resized. This happened when viewing the MySQLModel page or when viewing an EER diagram. (Bug #23959)

MySQL Utilities Change HistoryThe following sections outline the changes between versions for MySQL Utilities.

Changes in Release 1.0

Changes in MySQL Utilities 1.0.5 (10 April 2012)

This section documents all changes and bug fixes applied since the release of 1.0.4.

Functionality Added or Changed

• It is now possible for the mysqlserverclone utility to clone a downed server. Before, it was only ableto clone a running server. (Bug #13698224)

• Arguments for the utilities are no longer case-sensitive. And arguments now accept prefixed values,such as g or gr representing grid when passed to --format.

The --format and --help arguments have been standardized across all utilities. And as such, -h nolonger represents --help. (Bug #13554556)

• Added replication support to the mysqldbexport, mysqldbimport, and mysqldbcopy utilities.

This adds the following options to the mysqldbexport and mysqldbcopy utilities: --rpl, --rpl-file, --rpl-user, and --comment-rpl. And adds the --skip-rpl option to the mysqldbimportutility.

• Added the mysqlrpladmin utility, which allows administration and recovery of the replication topology.

• Added the mysqlfailover utility, which provides replication health monitoring. It relies on GlobalTransaction Identifiers (GTIDs) so requires MySQL Server 5.6.5 or greater.

Page 469: MySQL Workbench

Changes in Release 1.0

461

Bugs Fixed

• The mysqlserverinfo utility would fail when used with an offline version of MySQL Server 5.6. (Bug#13916903)

• The following utilities would not always exit properly, when executed from within MySQL Workbench:mysqlindexcheck, mysqlmetagrep, mysqlprocgrep, mysqlreplicate, mysqlrplcheck,mysqlrplshow, mysqlserverclone. (Bug #13721467)

• The MySQL Utilities Testing tool (mut) --sorted option had no function. It now accepts either asc ordesc, with asc remaining the default. (Bug #13592147)

• The --copy-dir option was removed from the mysqluserclone and mysqldbcopy utilities. (Bug#13576571)

• When executing a diff operation with the mysqldiff utility on a single server between two databaseswith missing objects, an invalid warning would be issued that did not show the correct servers involved.(Bug #13554750)

Changes in MySQL Utilities 1.0.4 (22 December 2011)

This section documents all changes and bug fixes applied since the release of 1.0.3.

Functionality Added or Changed

• Added the --write-command option to the mysqlserverclone utility, which saves the commandused to launch the new server instance. This command may also be shown while generated, dependingon the -verbose level. (Bug #13082771)

• Added the --locking option to the mysqldbcopy and mysqldbexport utilities, which now allows fortable locking.

• Added the --regexp option, which changes the --exclude option behavior to use REGEXP instead ofLIKE for its matching. This change affects the mysqldbcopy and mysqldbexport utilities.

• The mysqldbcompare utility can now generate SQL statements for synchronizing the objects and datafor the compared databases. This adds the --difftype, --changes-for, and --show-reverseoptions.

Also, enabling the --quiet option will now only generate the diff output for runs when the --difftypeoption is set, but not as =sql. And only output the SQL statements when --difftype is set to =sql.

• Added a parser for the slow and general logs, within the new mysql.utilities.parser module thatcontains the SlowLog, SlowLogEntry, GeneralLog, and GeneralLogEntry classes.

Bugs Fixed

• Installation would alter the permissions of /etc/profile.d/mysql-utilities.sh before creatingthe file. The order of operations has been corrected. (Bug #13115052)

• Optimized the mysqldbexport utility performance, namely for the_table.get_column_metadata() and table.get_column_string() methods. (Bug#13082780)

• The setup.py command would not generate all manual pages. (Bug #12988064)

• Refactored conditions to use list within the mysqldbexport and mysqldbimport utilities. (Bug#12945167)

Page 470: MySQL Workbench

Changes in Release 1.0

462

• The mysqldbcopy utility would crash when any of the data contained an apostrophe. (Bug #63145, Bug#13418634)

Changes in MySQL Utilities 1.0.3 (10 October 2011)

This section documents all changes and bug fixes applied since the release of 1.0.2.

Functionality Added or Changed

• Added the following options to the mysqlreplicate utility: --start-from-beginning, --master-log-file, and --master-log-pos

• Added the mysqlrplshow utility, which is used to show replication slaves.

Bugs Fixed

• Added the --all option to the mysqldbcopy and mysqldbexport utilities. (Bug #12885004)

• The mysqlreplicate utility no longer executes FLUSH TABLE WITH READ LOCK before obtainingthe master's status. (Bug #12887948)

• server.connect_servers would force the source and destination to be of the same type. (Bug#12871032)

• While using the mysqldbcopy utility, the % symbol within routines would be changed to %%. (Bug#12757358)

Changes in MySQL Utilities 1.0.2 (12 August 2011)

This section documents all changes and bug fixes applied since the release of 1.0.1.

Functionality Added or Changed

• Added the --new-storage-engine and --default-storage-engine options to themysqldbcopy and mysqldbimport utilities. (Bug #12632010)

• Refactored the exception handling in the python library for MySQL Utilities to be more granular, anddivided them into classes and errors types.

• Refactored the MySQL Utilities library to make the server connection use a variety of connectionparameters.

• Refactored the MySQL Utilities library to remove optional parameter lists, and replaced them with anoptions dictionary.

Bugs Fixed

• Exporting a database with tables containing a single column and a mixed set of storage engines couldresult in the wrong storage engine being used. (Bug #12631924)

• Several parts of the code referred to the incorrect postal address of the Free Software Foundation.(Bug #12614037)

• Attempting to connect to a host name containing hyphens using any of the python based command lineutilities would truncate the host name at the hyphen. (Bug #60252, Bug #11829755)

• Refactored the MySQL Utilities tree to remove extraneous files, fix test locations, and make mutresemble MTR's folder structure.

Page 471: MySQL Workbench

Changes in Release 1.0

463

• Added the mysqldbcompare utility, which is used to compare two databases.

• Added the mysqlrplcheck utility, which is used to check replication prerequisites.

Changes in MySQL Utilities 1.0.1 (11 May 2011)

This section documents all changes and bug fixes applied since the release of 1.0.0.

Functionality Added or Changed

• mysqlserverclone did not print out the connection information. (Bug #59095)

• With mysqluserclone, the --destination option is now optional, and defaults to the connectioninformation provided by --source. Before, both options were required even when the values wereidentical. (Bug #59096)

• Added the mysqldiff utility, which is used to check database definition differences.

• Added the mysqldiskusage utility, which is used to show disk usage information.

• Added the mysqlserverinfo utility, which is used to show MySQL server information.

Bugs Fixed

• Fixed a typo within the mysqldiskusage help page. (Bug #11854150)

• Diff related mut unit tests would fail with Python 2.7+. (Bug #11854512)

• The mysqldbexport, mysqlimport, and mysqldbcopy utilities would not form correct user@hostpairings with remote access privileges. (Bug #59478)

• mysqldiskusage did not work. A workaround was to fix the hashbang. (Bug #60852)

• mysqlreplicate would fail when the two servers had the same port number. (Bug #59477, Bug#11766376)

• The MySQL utilities unit tests would fail under MySQL 5.5, due to INFORMATION_SCHEMA changes.(Bug #60008)

• There were several installation related problems, including: everything was installed under /usr/localon Ubuntu (scripts not found), setuptools is used by utilities but not for c/Python (library not found), notall files were written while using --record during installation, and the required dependencies were notclarified in the README. (Bug #59083)

• The format_tabular_list() method in mysql.utilities.common.format.py did not properlyprint a single-column list. (Bug #59265, Bug #11766207)

Changes in MySQL Utilities 1.0.0 (07 December 2010)

First release of the MySQL Utilities.

Functionality Added or Changed

• Added the mysqlreplicate utility, which is used to quickly set up replication.

• Added the mysqlindexcheck utility, which is used for index checking.

• Added the mysqlprocgrep utility, which is used to find and operate on processes.

Page 472: MySQL Workbench

Changes in Release 1.0

464

• Added the mysqluserclone utility, which is used to clone users.

• Added the mut unit test framework.

• Added the mysqlserverclone utility, which is used to clone server instances.

• Added the mysqlmetagrep utility, which is used to search database object definitions.

• Added the documentation build system, which is based on sphinx.

• Added the mysqldbimport and mysqldbexport utilities, which are used to import and export data.

• Added the mysqldbcopy utility, which is used to copy databases.