2018-04-04 06:55:55 +00:00
|
|
|
.. _my_cnf:
|
|
|
|
|
|
|
|
******
|
|
|
|
my.cnf
|
|
|
|
******
|
|
|
|
|
|
|
|
|
|
|
|
``my.ini`` changes are global to all projects, but will only affect the currently selected
|
|
|
|
MySQL version.
|
|
|
|
|
|
|
|
|
2018-04-07 07:48:20 +00:00
|
|
|
.. important::
|
2018-06-03 18:45:01 +00:00
|
|
|
When using :ref:`docker_toolbox` on Windows, ``*.cnf`` files must have read-only file
|
|
|
|
permissions, otherwise they are not sourced by the MySQL server.
|
2018-04-07 07:48:20 +00:00
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
Make sure to ``chmod 0444 *.cnf`` after adding your values.
|
2018-04-07 07:48:20 +00:00
|
|
|
|
|
|
|
|
2018-04-04 06:55:55 +00:00
|
|
|
**Table of Contents**
|
|
|
|
|
|
|
|
.. contents:: :local:
|
|
|
|
|
|
|
|
|
|
|
|
General
|
|
|
|
=======
|
|
|
|
|
|
|
|
You can set custom MySQL options via your own defined ``my.cnf`` files for each version separately.
|
2018-04-05 07:09:38 +00:00
|
|
|
See the directory structure for MySQL configuration directories inside ``./cfg/`` directory:
|
2018-04-04 06:55:55 +00:00
|
|
|
|
2018-04-05 07:09:38 +00:00
|
|
|
.. code-block:: bash
|
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
host> ls -l path/to/devilbox/cfg/ | grep -E 'mysql|mariadb|percona'
|
2018-04-05 07:09:38 +00:00
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 mariadb-10.0/
|
|
|
|
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 mariadb-10.1/
|
|
|
|
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 mariadb-10.2/
|
|
|
|
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 mariadb-10.3/
|
|
|
|
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 mysql-5.5/
|
|
|
|
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 mysql-5.6/
|
|
|
|
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 mysql-5.7/
|
|
|
|
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 mysql-8.0/
|
|
|
|
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 percona-5.5/
|
|
|
|
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 percona-5.6/
|
|
|
|
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 percona-5.7/
|
2018-04-05 07:09:38 +00:00
|
|
|
|
|
|
|
Customization is achieved by placing a file into ``cfg/mysql-X.X/``, ``cfg/mariadb-X.X/`` or
|
2018-04-04 06:55:55 +00:00
|
|
|
``cfg/percona-X-X`` (where ``X.X`` stands for your MySQL version).
|
|
|
|
The file must end by ``.cnf`` in order to be sourced by the MySQL server.
|
|
|
|
|
|
|
|
Each of the MySQL cnf configuration directories already contain an example file:
|
|
|
|
``devilbox-custom.cnf-example``, that can simply be renamed to ``devilbox-custom.cnf``.
|
2018-04-07 07:48:20 +00:00
|
|
|
This file holds some example values that can be adjusted or commented out.
|
2018-04-04 06:55:55 +00:00
|
|
|
|
|
|
|
In order for the changes to be applied, you will have to restart the Devilbox.
|
|
|
|
|
|
|
|
|
|
|
|
Examples
|
|
|
|
========
|
|
|
|
|
|
|
|
Change key_buffer_size for MySQL 5.5
|
|
|
|
------------------------------------
|
|
|
|
|
|
|
|
The following examples shows you how to change the
|
|
|
|
`key_buffer_size <https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_key_buffer_size>`_
|
|
|
|
of MySQL 5.5 to 16 MB.
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
# Navigate to the Devilbox directory
|
|
|
|
host> cd path/to/devilbox
|
2018-04-04 06:55:55 +00:00
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
# Navigate to MySQL 5.5 config directory
|
|
|
|
host> cd cfg/mysql-5.5
|
2018-04-04 06:55:55 +00:00
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
# Create new cnf file
|
|
|
|
host> touch key_buffer_size.cnf
|
2018-04-04 06:55:55 +00:00
|
|
|
|
|
|
|
Now add the following content to the file:
|
|
|
|
|
|
|
|
.. code-block:: ini
|
2018-06-03 18:45:01 +00:00
|
|
|
:caption: memory_limit.cnf
|
2018-04-04 06:55:55 +00:00
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
[mysqld]
|
|
|
|
key_buffer_size=16M
|
2018-04-04 06:55:55 +00:00
|
|
|
|
|
|
|
In order to apply the changes you need to restart the Devilbox.
|
|
|
|
You can validate that the changes have taken place by visiting the Devilbox intranet MySQL info page.
|
|
|
|
|
|
|
|
|
|
|
|
Change timeout and packet size for PerconaDB 5.7
|
|
|
|
------------------------------------------------
|
|
|
|
|
|
|
|
The following examples shows you how to change the
|
|
|
|
`wait_timeout <https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_wait_timeout>`_
|
|
|
|
and
|
|
|
|
`max_allowed_packet <https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_max_allowed_packet>`_
|
|
|
|
of PerconaDB 5.7
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
# Navigate to the Devilbox directory
|
|
|
|
host> cd path/to/devilbox
|
2018-04-04 06:55:55 +00:00
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
# Navigate to PerconaDB 5.7 config directory
|
|
|
|
host> cd cfg/percona-5.7
|
2018-04-04 06:55:55 +00:00
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
# Create new ini file
|
|
|
|
host> touch timeouts.cnf
|
2018-04-04 06:55:55 +00:00
|
|
|
|
|
|
|
Now add the following content to the file:
|
|
|
|
|
|
|
|
.. code-block:: ini
|
2018-06-03 18:45:01 +00:00
|
|
|
:caption: timeouts.cnf
|
2018-04-04 06:55:55 +00:00
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
[mysqld]
|
|
|
|
max_allowed_packet=256M
|
|
|
|
wait_timeout = 86400
|
2018-04-04 06:55:55 +00:00
|
|
|
|
|
|
|
In order to apply the changes you need to restart the Devilbox.
|
|
|
|
You can validate that the changes have taken place by visiting the Devilbox intranet MySQL info page.
|