This section provides configuration options that affect the SQL editor functionality in MySQL Workbench. As the following figure shows, the SQL editor preferences include both general options and others that apply to specific editors:
Save snapshot of open editors on close
Enabled by default. Permits saving and reloading the SQL editor tabs after MySQL Workbench is closed and reopened (including after an unexpected shutdown).
Auto-save scripts interval: [
Frequency of the automatic saves. Scripts are restored from the last saved version, if MySQL Workbench shuts down.
Create new tabs as Query tabs instead of File
By default, opening a new SQL editor tab opens as an SQL File tab. Select this option if you prefer the simpler Query tabs that, for example, do not prompt to be saved when closed.
Restore expanded state of the active schema objects
Enabled by default. Group nodes that were previously expanded in the active schema when the SQL editor was last closed are re-expanded and loaded.
Show Schema Contents in Schema Tree
Enabled by default. Enumerating, populating, and drawing large numbers of items can significantly increase loading times. For this reason, this facility can be switched off for models containing large numbers of schemas and tables.
Show Metadata and Internal Schemas
Whether to show metadata and internal schemas in the schema tree, such as
mysql, and schemas starting with the period character (
DBMS connection keep-alive interval (in seconds): [
Time interval between sending keep-alive messages to the DBMS. Set the value to
0to not send keep-alive messages.
DBMS connection read timeout interval (in seconds):[
The maximum amount of time the query can take to return data from the DBMS. Set the value to
0to skip the read timeout.
DBMS connection timeout interval (in seconds): [
Maximum time to wait before a connection attempt is aborted.
Internal Workbench Schema: [
This schema is used by MySQL Workbench to store information required for certain operations, such as saving shared SQL snippets.
Safe Updates (rejects UPDATEs and DELETEs with no restrictions)
Enabled by default. Prevents
DELETEqueries that lack a corresponding key in a
WHEREclause, or lack a
LIMITclause, from executing. This option requires a MySQL server reconnection.
When selected, this preference makes it possible to catch
DELETEstatements with keys that are not used properly and that can probably accidentally change or delete a large number of rows.
The following figure shows the preference options that apply to the query editor.
Enable Code Completion in Editors
The SQL Editor offers autocomplete functionality by either pressing the keyboard shortcut (Modifier + Space), or it will start automatically if the Automatically Start Code Completion preference is enabled.
Automatically Start Code Completion
Enabled by default. This option automatically executes the code autocomplete feature while editing SQL in the SQL editor. If disabled, you can instead use the keyboard shortcut Modifier + Space to execute the autocomplete routine.
Use UPPERCASE keywords on completion
Normally keywords are shown and inserted as they come from the code editor's configuration file. This setting will always write completed keywords as uppercase.
Comment type to use for comment shortcut: [
Defaults to the
--comment characters, with the
#character as an alternative comment option.
Max syntax error count: [
Large complex scripts may contain errors. Further, a syntax error early on can lead to subsequent syntax errors. For these reasons, it is possible to limit the number of errors displayed using this option. The default is 100 error messages.
Max number of result sets: [
Maximum number of result sets for SQL queries that can be opened for a single SQL editor. Defaults to 50. Reaching the limit emits a warning.
Change keywords to UPPER CASE
Enabled by default. Executing the SQL beautifier sets all SQL keywords to uppercase.
The following figure shows the preference options that apply to all object editors.
Default algorithm for ALTER table: [
Sets the default algorithm when performing
ALTER TABLEoperations in MySQL Workbench. The setting can also be adjusted for each
ALTER TABLEoperation. Options include
Copy. See the online DDL documentation for more information.
Default lock for ALTER table: [
Sets the default lock setting to allow concurrent queries with
ALTER TABLEin MySQL Workbench. This setting can also be adjusted for each
ALTER TABLEoperation. Options include
Exclusive. See the online DDL documentation for more information.
Reformat DDL for Views
Enabled by default. Determines whether to automatically reformat the View DDL that is returned by the MySQL server.Note
MySQL server instances do not store the formatting information for View definitions.
The following figure shows the preference options that apply to SQL execution.
Max. query length to store in history (in bytes): [
Queries that exceed this size are not be saved in the history when executed. Setting this value to
0eliminates the limit (all queries are saved).
Continue on SQL script execution on errors (by default)
Should an error occur while executing a script, this option causes the execution to continue for the remainder of the script.
New connections use auto commit mode
Enabled by default. Toggles the default autocommit mode for new connections. When enabled, the editor commits each statement immediately.Note
All query tabs in the same connection share the same transaction. To have independent transactions, you must open a new connection.
Progress status update interval (in milliseconds): [
When executing long running queries over a slow connection, you may need to increase this value to prevent excess load on the connection.
SELECT Query Results
Enabled by default. Queries can sometimes return an excessive number of rows, which can heavily load the connection, and take time to display in MySQL Workbench. To prevent this, you can set a more moderate value here. This limit is defined by the Limit Rows Count option.
Limit Rows Count: [
Specify the maximum number of result rows to return.
Max. Field Value Length to Display (in bytes): [
To avoid display problems due to excessive field length, it is possible to set the maximum field length to display (in bytes).
Treat BINARY/VARBINARY as non-binary character string
Binary byte string values are not displayed by default in the results grid, but are instead marked as
BLOBvalues. These can then be viewed or edited with the
BLOBeditor. Nonbinary character string values are displayed in the results grid, and can be edited in the grid cell or using the
If this option is turned on, data truncation may result: Binary byte string values may contain null bytes as part of their valid data, whereas for nonbinary character strings, a null byte terminates the string.
Confirm Data Changes
Enabled by default. If you edit table data in the SQL Editor and then click, MySQL Workbench launches a wizard to step through your changes before applying them. If this option is deselected, the changes are applied to the server without the wizard being displayed and without giving you a chance to review the changes.
Preserve Row Filter
Enabled by default. This option preserves the active filter on resultset changes. The filter is reset when the option is disabled.