3
.. _configuration_variables:
8
Variables reflect the running configuration of Drizzle.
9
Variables allow you to configure (or reconfigure) certain values at runtime,
10
whereas :ref:`configuration_options` configure Drizzle at startup and cannot
11
be changed without restarting Drizzle.
13
To see which variables are avaiable, execute the following:
17
drizzle> SELECT * FROM DATA_DICTIONARY.GLOBAL_VARIABLES;
18
+--------------------------------------------+--------------------+
19
| Variable_name | Value |
20
+--------------------------------------------+--------------------+
21
| auto_increment_increment | 1 |
22
| auto_increment_offset | 1 |
25
| basedir | /opt/drizzle |
26
| bulk_insert_buffer_size | 8388608 |
27
| collation_server | utf8_general_ci |
28
| completion_type | 0 |
29
| datadir | /opt/drizzle/data |
30
| div_precision_increment | 4 |
31
| drizzle_protocol_bind_address | localhost |
32
| drizzle_protocol_buffer_length | 16384 |
33
| drizzle_protocol_connect_timeout | 10 |
34
| drizzle_protocol_max_connections | 1000 |
35
| drizzle_protocol_port | 290132299 |
36
| drizzle_protocol_read_timeout | 30 |
37
| drizzle_protocol_retry_count | 10 |
38
| drizzle_protocol_write_timeout | 60 |
40
| foreign_key_checks | ON |
43
The ``DATA_DICTIONARY.GLOBAL_VARIABLES`` and
44
``DATA_DICTIONARY.SESION_VARIABLES`` views only list the available variables
45
and their current values, but internally each variable has four attributes
46
which affect how, if, and when it can be set:
53
Variable are created either by the Drizzle kernel or by a plugin.
54
Varaibles created by a plugin are prefixed with the plugin's name.
55
For example, ``drizzle_protocol_port`` is created by the
56
:doc:`/plugins/drizzle_protocol/index` plugin. Else, the variable
57
is created by the Drizzle kernel.
59
Most variables have a corresponding
60
:ref:`command line option <command_line_options>` which
61
initializes the variable. For example, :option:`--drizzle-protocol.port`
62
initializes ``drizzle_protocol_port``. Command line options are
63
converted to variable names by stripping
64
the option's leading ``--`` and changing all ``-`` (hyphens) and ``.``
65
(periods) to ``_`` (underscores). Variables without corresponding
66
command line options are are usually switches (to enable or disable
67
some feature) or counters (like ``error_count``), and these variables can
68
only be accessed or changed once Drizzle is running.
70
Dynamic variables can be changed at runtime, and the new value takes
71
affect immediately. Documentation for each variables indicates if it is
72
dynamic or not. Most variables, however, are static which means that
73
they only reflect the value of their corresponding option. To change a static
74
variable, you must change its corresponding option, then restart Drizzle.
75
Certain variables are static and do not have a corresponding option because
76
they are purely informational, like ``version`` and ``version_comment``.
78
A variable's scope is either global, session, or both (global and session).
79
Global variables apply to all connections (each connection is a session).
80
Session variables apply to each connection and changes to a session in one
81
connection do not change or affect the same variable in another connection.
82
Changes to session variables are lost when the connection closes, but
83
changes to global variables remain in affect until changed again.
85
.. note:: Configuration variables and :ref:`user_defined_variables` are different. :ref:`user_defined_variables` do not affect the configuration of Drizzle, and they are always dynamic, session variables.
87
.. _setting_variables:
92
The ``SET`` command sets global and session variables:
96
-- Set global variable
97
SET GLOBAL variable=value;
99
-- Set sesion variable
101
SET SESSION variable=value
103
If setting the variable succeeds, the command finishes silently like:
105
.. code-block:: mysql
107
drizzle> SET SESSION max_allowed_packet=10485760;
108
Query OK, 0 rows affected (0.001475 sec)
110
Else, an error occurs if the variable cannot be changed:
112
.. code-block:: mysql
114
drizzle> SET tmpdir="/tmp";
115
ERROR 1238 (HY000): Variable 'tmpdir' is a read only variable
117
.. _querying_variables:
122
The ``DATA_DICTIONARY.GLOBAL_VARIABLES`` and
123
``DATA_DICTIONARY.SESSION_VARIABLES`` are views for querying
124
global and session variables respectively. For example, to see all
125
variables for the :doc:`/plugins/syslog/index` plugin:
127
.. code-block:: mysql
129
drizzle> SELECT * FROM DATA_DICTIONARY.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'syslog_%';
130
+----------------------------------------+----------------+
131
| VARIABLE_NAME | VARIABLE_VALUE |
132
+----------------------------------------+----------------+
133
| syslog_errmsg_enable | OFF |
134
| syslog_errmsg_priority | warning |
135
| syslog_facility | local0 |
136
| syslog_logging_enable | OFF |
137
| syslog_logging_priority | warning |
138
| syslog_logging_threshold_big_examined | 0 |
139
| syslog_logging_threshold_big_resultset | 0 |
140
| syslog_logging_threshold_slow | 0 |
141
+----------------------------------------+----------------+