Database Reference
In-Depth Information
[mysqld]
character_set_server=utf8
sql_mode=TRADITIONAL
event_scheduler=1
innodb_buffer_pool_size=256M
Those are just suggestions; adjust the server configuration for your own requirements.
For information about plug-in and logging options in particular, see Recipes
22.2
and
22.3
.
Configuration control and verification at runtime
After the server starts, you can make runtime adjustments by changing system variables
using the
SET
statement:
SET
GLOBAL
var_name
=
value
;
That statement sets the global value of
var_name
; that is, the value that applies to all
clients by default. Changes to the global value at runtime require the
SUPER
privilege.
Many system variables also have a session value, which is the value specific to a particular
client session. The session value of a given variable is initialized from the global value
when the client connects, but the client can change it thereafter. For example, the DBA
might set the sort buffer size at server startup:
[mysqld]
sort_buffer_size=512K
That sets the global value. A DBA with the
SUPER
privilege can change the global value
at runtime:
SET
GLOBAL
sort_buffer_size
=
1024
*
256
;
Each client that connects subsequently has its session variable initialized to the same
value, but can change the value as it likes. A client that performs large sorts might
increase the value:
SET
SESSION
sort_buffer_size
=
1024
*
1024
;
A
SET
statement that includes no
GLOBAL
or
SESSION
modifier changes the session value,
if there is one.
There is alternative syntax for writing system variable references:
SET
@@
GLOBAL
.
var_name
=
value
;
SET
@@
SESSION
.
var_name
=
value
;
The
@@
syntax is more flexible. It can be used in statements other than
SET
, enabling you
to retrieve or examine individual system variables: