MySQL Workbench
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:
SQL Editor
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: [ 10
seconds
]
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.
Sidebar
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 INFORMATION_SCHEMA
,
mysql
, and schemas starting with the
period character (.
).
MySQL Session
DBMS connection keep-alive interval (in seconds):
[600
]
Time interval between sending keep-alive messages to the
DBMS. Set the value to 0
to not send
keep-alive messages.
DBMS connection read timeout interval (in
seconds):[30
]
The maximum amount of time the query can take to return data
from the DBMS. Set the value to 0
to skip
the read timeout.
DBMS connection timeout interval (in seconds):
[60
]
Maximum time to wait before a connection attempt is aborted.
Other
Internal Workbench Schema:
[.mysqlworkbench
]
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 UPDATE
and
DELETE
queries that lack a corresponding
key in a WHERE
clause, or lack a
LIMIT
clause, from executing. This option
requires a MySQL server reconnection.
When selected, this preference makes it possible to catch
UPDATE
and DELETE
statements 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.
Productivity
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: [
100
]
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: [
50
]
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.
SQL Beautifier
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.
Online DDL
Default algorithm for ALTER table: [
Default
]
Sets the default algorithm when performing
ALTER TABLE
operations in
MySQL Workbench. The setting can also be adjusted for each
ALTER TABLE
operation.
Options include Default
,
In-Place
(preferred), and
Copy
. See the
online DDL
documentation for more information.
Default lock for ALTER table: [
Default
]
Sets the default lock setting to allow concurrent queries
with ALTER TABLE
in
MySQL Workbench. This setting can also be adjusted for each
ALTER TABLE
operation.
Options include Default
,
None
, Shared
, and
Exclusive
. See the
online DDL
documentation for more information.
Views
Reformat DDL for Views
Enabled by default. Determines whether to automatically reformat the View DDL that is returned by the MySQL server.
MySQL server instances do not store the formatting information for View definitions.
The following figure shows the preference options that apply to SQL execution.
General
Max. query length to store in history (in bytes):
[ 65536
]
Queries that exceed this size are not be saved in the
history when executed. Setting this value to
0
eliminates 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.
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):
[ 500
]
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
Limit Rows
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: [ 200
]
Specify the maximum number of result rows to return.
Max. Field Value Length to Display (in bytes): [
256
]
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
BLOB
values. These can then be viewed 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 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.