My cnf mysql где находится
Перейти к содержимому

My cnf mysql где находится

  • автор:

My cnf mysql где находится

Начиная с версии 3.22 MySQL может считывать принятые по умолчанию параметры запуска для сервера и клиентов из файлов параметров.

В Unix считывание принятых по умолчанию параметров MySQL производится из следующих файлов:

Имя файла Назначение
/etc/my.cnf Общие параметры
DATADIR/my.cnf Параметры для сервера
defaults-extra-file Файл, указанный при помощи -defaults-extra-file=#
~/.my.cnf Параметры для пользователя

DATADIR является каталогом данных MySQL (обычно `/usr/local/mysql/data' для бинарной установки или `/usr/local/var' для установки из исходных текстов). Обратите внимание, что это тот каталог, который был задан во время настройки, а не указанный при помощи —datadir при запуске mysqld ! ( —datadir не оказывает влияния на просмотр файлов параметров сервером, так как их просмотр происходит до обработки аргументов командной строки).

В Windows считывание принятых по умолчанию параметров MySQL производится из следующих файлов:

Имя файла Назначение
windows-system-directory\my.ini Общие параметры
C:\my.cnf Общие параметры

Обратите внимание на то, что в Windows все пути необходимо указывать при помощи / вместо \. Если необходимо использовать \, то его нужно указать дважды, так как \ является знаком перехода в MySQL.

MySQL пытается прочитать файлы параметров в указанном выше порядке. Если существует несколько таких файлов, то параметр, указанный в файле, идущем позже, имеет преимущество над таким же параметром, указанным в файле, расположенном ранее. Параметры, указанные в командной строке, обладают более высоким приоритетом по отношению к параметрам, указанным в любом из файлов параметров. Некоторые параметры можно задавать при помощи переменных окружения. Параметры, указанные в командной строке или в файлах параметров, обладают преимуществом по отношению к переменным окружения (see section F Переменные окружения).

Приводим список программ, поддерживающих файлы параметров: mysql , mysqladmin , mysqld , mysqld_safe , mysql.server , mysqldump , mysqlimport , mysqlshow , mysqlcheck , myisamchk и myisampack .

Любой параметр, который может быть задан в командной строке при запуске программы MySQL, может быть также задан в файле параметров (без предваряющего двойного слэша). Чтобы получить список доступных параметров, следует запустить программу с параметром —help .

Файлы параметров могут содержать строки следующего вида:

#comment Строки комментариев начинаются с символа `#’ или `;’ . Пустые строки игнорируются. [group] группа представляет собой имя программы или группы, для которой необходимо задать параметры. Любые параметры или строки, задающие значения переменных, которые указаны после строки группы, будут относиться к названной группе, пока не закончится файл параметров или же не будет указана другая строка группы. option Эквивалент —option в командной строке. option=value Эквивалент —option=value в командной строке. set-variable = variable=value Эквивалент —set-variable variable=value в командной строке. Данный синтаксис необходимо использовать для задания переменных mysqld .

Группа client обеспечивает возможность задавать параметры, относящиеся ко всем клиентам MySQL (кроме самого mysqld ). Эта группа великолепно подходит для указания пароля, используемого при подсоединении к серверу (но при этом следует убедиться, что разрешение на чтение и запись этого файла есть только у вас).

Обратите внимание на то, что для параметров и значений все введенные перед ними и после них пробелы автоматически удаляются. В строках значений можно использовать такие экранирующие секвенции: `\b’ , `\t’ , `\n’ , `\r’ , `\\’ и `\s’ ( `\s’ — это пробел).

Пример типичного глобального файла параметров:

[client] port=3306 socket=/tmp/mysql.sock [mysqld] port=3306 socket=/tmp/mysql.sock set-variable = key_buffer_size=16M set-variable = max_allowed_packet=1M [mysqldump] quick

Пример типичного файла параметров пользователя:

[client] # Указанный пароль будет направлен всем стандартным клиентам MySQL password=my_password [mysql] no-auto-rehash set-variable = connect_timeout=2 [mysqlhotcopy] interactive-timeout

Если у вас дистрибутив исходного кода, то примеры конфигурационных файлов с именами `my-xxxx.cnf' можно найти в каталоге `support-files'. В случае бинарного дистрибутива следует обратиться к каталогу `DIR/support-files', где DIR — имя каталога установки MySQL (обычно `/usr/local/mysql'). На данный момент там приведены примеры файлов конфигурации для малых, средних, больших и очень больших систем. Чтобы поэкспериментировать с файлом, можно скопировать `my-xxxx.cnf' в свой домашний каталог (переименуйте копию в `.my.cnf').

Все поддерживающие файлы параметров клиенты MySQL принимают следующие параметры:

Параметр Описание
—no-defaults Не читать информацию из файлов параметров.
—print-defaults Вывести имя программы и все параметры, которые ей передаются.
—defaults-file=full-path-to-default-file Использовать только указанный файл конфигурации.
—defaults-extra-file=full-path-to-default-file Прочитать этот файл конфигурации после глобального файла конфигурации, но перед файлом конфигурации пользователя.

Обратите внимание на то, что указанные выше параметры должны идти первыми в командной строке! Однако параметр —print-defaults может использоваться сразу после команд —defaults-xxx-file .

Примечание для разработчиков: обработка файла параметров происходит следующим образом: все совпадающие параметры (т.е. параметры в соответствующих группах) обрабатываются перед любыми аргументами командной строки. Этот алгоритм хорошо подходит для программ, которые в случае, если один и тот же параметр указывается несколько раз, используют последний экземпляр параметра. Если же вы работаете со старой программой, которая считывает заданные несколько раз параметры указанным образом, но не читает файлы параметров, необходимо добавить только две строки, чтобы у нее появилась эта возможность. Чтобы увидеть, как это делается, достаточно ознакомиться с исходным кодом любого стандартного клиента MySQL.

В скриптах оболочки для анализа файлов config можно использовать команду `my_print_defaults':

shell> my_print_defaults client mysql --port=3306 --socket=/tmp/mysql.sock --no-auto-rehash

Приведенные выше выходные данные содержат все параметры для групп client и mysql .

my.cnf

my.cnf — это файл конфигурации MySQL. Чтобы найти файл, используйте команду:

Ефективний курс від robotdreams: Software Architect.
Від ідеї до коду.

В Linux’e обычно он находится по такому пути:

/etc/my.cnf # либо /etc/mysql/my.cnf

Редактирование

Для редактирования необходимо открыть файл my.cnf в текстовом редакторе:

Потужний курс від laba: Управління ІТ-командами.
Максимізуйте продуктивність вашої ІТ-команди.

После внесения изменений в файл, необходимо делать перезапуск mysql:

Пример конфигурации

Это пример настроек Mysql для сервера с 1Гб оперативной памяти и двумя ядрами:

client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp language = /usr/share/mysql/english old_passwords = 0 bind-address = 127.0.0.1 skip-external-locking max_allowed_packet = 16M key_buffer = 16M [p:innodb_buffer_pool_size] = 512M [p:innodb_file_per_table] = 1 [p:innodb_flush_method] = O_DIRECT [p:innodb_flush_log_at_trx_commit] = 0 thread_stack = 128K [p:thread_cache_size] = 128 myisam-recover = BACKUP max_connections = 128 table_cache = 32 query_cache_limit = 1M [p:query_cache_size] = 4M [p:slow_query_log] = /var/log/mysql/mysql-slow.log long_query_time = 1 expire_logs_days = 10 [p:max_binlog_size] = 100M [mysqldump] quick quote-names max_allowed_packet = 16M

Если в вашем конфиге есть настройка thread_concurrency — уберите ее.

Стандартные конфигурации

Для удобства используйте одну из указанных конфигураций для вашего сервера:

Для 2Гб оперативной памяти

[client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp language = /usr/share/mysql/english old_passwords = 0 bind-address = 127.0.0.1 skip-external-locking max_allowed_packet = 16M key_buffer_size = 16M innodb_buffer_pool_size = 1024M innodb_file_per_table = 1 innodb_flush_method = O_DIRECT innodb_flush_log_at_trx_commit = 0 max_connections = 136 query_cache_size = 0 slow_query_log = /var/log/mysql/mysql-slow.log long_query_time = 1 expire_logs_days = 10 max_binlog_size = 100M [mysqldump] quick quote-names max_allowed_packet = 16M

Для 4Гб оперативной памяти

[client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp language = /usr/share/mysql/english old_passwords = 0 bind-address = 127.0.0.1 skip-external-locking max_allowed_packet = 16M key_buffer_size = 16M innodb_buffer_pool_size = 2048M innodb_file_per_table = 1 innodb_flush_method = O_DIRECT innodb_flush_log_at_trx_commit = 0 max_connections = 144 query_cache_size = 0 slow_query_log = /var/log/mysql/mysql-slow.log long_query_time = 1 expire_logs_days = 10 max_binlog_size = 100M [mysqldump] quick quote-names max_allowed_packet = 16M

Для 8Гб оперативной памяти

[client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp language = /usr/share/mysql/english old_passwords = 0 bind-address = 127.0.0.1 skip-external-locking max_allowed_packet = 16M key_buffer_size = 16M innodb_buffer_pool_size = 4096M innodb_file_per_table = 1 innodb_flush_method = O_DIRECT innodb_flush_log_at_trx_commit = 0 max_connections = 160 query_cache_size = 0 slow_query_log = /var/log/mysql/mysql-slow.log long_query_time = 1 expire_logs_days = 10 max_binlog_size = 100M [mysqldump] quick quote-names max_allowed_packet = 16M

Для 16Гб оперативной памяти

Ефективний курс від skvot: Режисура відеороликів.
Творча магія кінематографу.

[client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp language = /usr/share/mysql/english old_passwords = 0 bind-address = 127.0.0.1 skip-external-locking max_allowed_packet = 16M key_buffer_size = 16M innodb_buffer_pool_size = 8192M innodb_file_per_table = 1 innodb_flush_method = O_DIRECT innodb_flush_log_at_trx_commit = 0 max_connections = 192 query_cache_size = 0 slow_query_log = /var/log/mysql/mysql-slow.log long_query_time = 1 expire_logs_days = 10 max_binlog_size = 100M [mysqldump] quick quote-names max_allowed_packet = 16M

Для 32Гб оперативной памяти

[client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp language = /usr/share/mysql/english old_passwords = 0 bind-address = 127.0.0.1 skip-external-locking max_allowed_packet = 16M key_buffer_size = 16M innodb_buffer_pool_size = 16384M innodb_file_per_table = 1 innodb_flush_method = O_DIRECT innodb_flush_log_at_trx_commit = 0 max_connections = 256 query_cache_size = 0 slow_query_log = /var/log/mysql/mysql-slow.log long_query_time = 1 expire_logs_days = 10 max_binlog_size = 100M [mysqldump] quick quote-names max_allowed_packet = 16M

Для 64Гб оперативной памяти

[client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp language = /usr/share/mysql/english old_passwords = 0 bind-address = 127.0.0.1 skip-external-locking max_allowed_packet = 16M key_buffer_size = 16M innodb_buffer_pool_size = 32768M innodb_file_per_table = 1 innodb_flush_method = O_DIRECT innodb_flush_log_at_trx_commit = 0 max_connections = 384 query_cache_size = 0 slow_query_log = /var/log/mysql/mysql-slow.log long_query_time = 1 expire_logs_days = 10 max_binlog_size = 100M [mysqldump] quick quote-names max_allowed_packet = 16M

Для 128Гб оперативной памяти

[client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp language = /usr/share/mysql/english old_passwords = 0 bind-address = 127.0.0.1 skip-external-locking max_allowed_packet = 16M key_buffer_size = 16M innodb_buffer_pool_size = 65536M innodb_file_per_table = 1 innodb_flush_method = O_DIRECT innodb_flush_log_at_trx_commit = 0 max_connections = 640 query_cache_size = 0 slow_query_log = /var/log/mysql/mysql-slow.log long_query_time = 1 expire_logs_days = 10 max_binlog_size = 100M [mysqldump] quick quote-names max_allowed_packet = 16M

Этот текст был написан несколько лет назад. С тех пор упомянутые здесь инструменты и софт могли получить обновления. Пожалуйста, проверяйте их актуальность.

Где найти файл my.cnf?

5f48b61bc4427344343768.png

Логично, что /etc/mysql/my.cnf то что мне нужно, но когда я открываю его получаю вот такое:

В итоге, цель следующая:
Я имею проблему с ошибкой: MySQL Server Has Gone Awa
Рекомендации: Увеличить max_allowed_packet и wait_timeout .

max_allowed_packet — Я увеличил в /etc/mysql/mysql.conf.d/mysqld.cnf и кажется после перезагрузки сервера параметр остался (проверял через команду в phpmyadmin)
wait_timeout — Отсутствует в файле: /etc/mysql/mysql.conf.d/mysqld.cnf и поэтому не могу понять где его изменять.

  • Вопрос задан более трёх лет назад
  • 1522 просмотра

How do I find the MySQL my.cnf location

Is there a MySQL command to locate the my.cnf configuration file, similar to how PHP’s phpinfo() locates its php.ini ?

421 8 8 silver badges 24 24 bronze badges
asked Mar 20, 2010 at 6:54
17.6k 19 19 gold badges 54 54 silver badges 56 56 bronze badges
on ubuntu, you may use the command locate my.cnf to find where are all such file names are
Dec 3, 2019 at 6:19
You might need to install locate using: sudo apt install locate
Feb 7, 2022 at 22:14

30 Answers 30

There is no internal MySQL command to trace this, it’s a little too abstract. The file might be in 5 (or more?) locations, and they would all be valid because they load cascading.

  • /etc/my.cnf
  • /etc/mysql/my.cnf
  • $MYSQL_HOME/my.cnf
  • [datadir]/my.cnf
  • ~/.my.cnf

Those are the default locations MySQL looks at. If it finds more than one, it will load each of them & values override each other (in the listed order, I think). Also, the —defaults-file parameter can override the whole thing, so. basically, it’s a huge pain in the butt.

But thanks to it being so confusing, there’s a good chance it’s just in /etc/my.cnf.

(If you just want to see the values: SHOW VARIABLES , but you’ll need the permissions to do so.)

Run mysql —help and you will see:

Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf

enter image description here

14.8k 9 9 gold badges 119 119 silver badges 201 201 bronze badges
answered Mar 21, 2010 at 3:12
8,621 1 1 gold badge 18 18 silver badges 9 9 bronze badges
Make sure to restart MySQL server after editing my.cnf: /etc/init.d/mysqld restart .
Nov 24, 2014 at 15:44
For me (AWS EC2 Ubuntu), my.cnf is located in /etc/mysql/my.cnf .
Jun 16, 2015 at 16:01

Run mysql —help and you will see Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf

Dec 16, 2015 at 3:44

in my case there was an symlink etc/mysql/my.cnf pointing to another symlink /etc/alternatives/my.cnf which points to etc/mysql/mysql.cnf .

Jan 29, 2017 at 19:11
ls /etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf
Jun 16, 2018 at 0:17

You can actually «request» MySQL for a list of all locations where it searches for my.cnf (or my.ini on Windows). It is not an SQL query though. Rather, execute:

$ mysqladmin --help 
$ mysqld --help --verbose 

In the very first lines you will find a message with a list of all my.cnf locations it looks for. On my machine it is:

Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf 
Default options are read from the following files in the given order: C:\Windows\my.ini C:\Windows\my.cnf C:\my.ini C:\my.cnf C:\Program Files\MySQL\MySQL Server 5.5\my.ini C:\Program Files\MySQL\MySQL Server 5.5\my.cnf 

Note however, that it might be the case that there is no my.cnf file at any of these locations. So, you can create the file on your own — use one of the sample config files provided with MySQL distribution (on Linux — see /usr/share/mysql/*.cnf files and use whichever is appropriate for you — copy it to /etc/my.cnf and then modify as needed).

Also, note that there is also a command line option —defaults-file which may define custom path to my.cnf or my.ini file. For example, this is the case for MySQL 5.5 on Windows — it points to a my.ini file in the data directory, which is not normally listed with mysqld —help —verbose . On Windows — see service properties to find out if this is the case for you.

Finally, check the https://dev.mysql.com/doc/refman/8.0/en/option-files.html — it is described there in more details.

5,030 3 3 gold badges 34 34 silver badges 62 62 bronze badges
answered Mar 7, 2012 at 14:22
12.4k 7 7 gold badges 50 50 silver badges 73 73 bronze badges

Looked promising but on my distro (opencsw.org), there is not mysqld. It runs mysqld_safe. «mysqld_safe —verbose —help» is not recognized.

Mar 28, 2012 at 14:24

when I ran it, I got this: Default options are read from the following files in the given order: /etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf — I expected the first 2 files in reverse order.

Feb 28, 2013 at 22:57

The information posted by mysqld —help —verbose contradicts what’s stated in dev.mysql.com/doc/refman/5.5/en/option-files.html. In my «recent as of today» experience with version 5.6, the information in the website is the most correct and relevant. The priority of the files location given by the help command is misleading and will lead to negative results.

Dec 1, 2013 at 10:53
On my old Fedora it was mysql —help —verbose
Mar 22, 2015 at 10:20

Note that I had to increase the cmd buffer size to 3000 to be able to actually see the first lines, otherwise the text was simply overwritten. When they say «verbose», apparently, they mean it.

Nov 3, 2016 at 4:43

You could always run find in a terminal.

find / -name my.cnf 

answered Mar 20, 2010 at 9:06
1,239 7 7 silver badges 5 5 bronze badges

it’s the hard way 🙁 Is there any mysql command like the phpinfo() to know the config file location ?

Mar 20, 2010 at 18:13

find / -name my.cnf is your best bet, but you could also check your home directory and /etc/mysql/my.conf You can also see if your MYSQL_HOME is set by typing echo $MYSQL_HOME in a terminal

Mar 20, 2010 at 20:58

Wow, that would take forever on most machines. Most modern linuxes have locate installed and so long as updatedb is run regularly you can do a: locate my.cnf | less

Mar 21, 2010 at 2:36

This only shows what files are named my.cnf. It doesn’t tell you which on the mysqld process found and opened.

Mar 28, 2012 at 14:21

This doesn’t find ~/.my.cnf — note the leading dot in the file name. Also running a find over the entire file system will usually generate scads of «Permission denied» errors unless you are root. So the find command should be find / -name ‘*my.cnf’ 2>/dev/null .

May 14, 2014 at 13:09

mysql --help | grep /my.cnf | xargs ls 

will tell you where my.cnf is located on Mac/Linux

ls: cannot access '/etc/my.cnf': No such file or directory ls: cannot access '~/.my.cnf': No such file or directory /etc/mysql/my.cnf 

In this case, it is in /etc/mysql/my.cnf

ls: /etc/my.cnf: No such file or directory ls: /etc/mysql/my.cnf: No such file or directory ls: ~/.my.cnf: No such file or directory /usr/local/etc/my.cnf 

In this case, it is in /usr/local/etc/my.cnf

answered Jul 6, 2019 at 14:35
13.9k 9 9 gold badges 65 65 silver badges 75 75 bronze badges
Why is this not the answer?
Oct 24, 2019 at 12:54

I know I am late to the party — but what if my.cnf doesn’t exist anywhere? ls: /etc/my.cnf: No such file or directory ls: /etc/mysql/my.cnf: No such file or directory ls: /usr/local/mysql/etc/my.cnf: No such file or directory ls: ~/.my.cnf: No such file or directory

Sep 5, 2021 at 9:26

This is the only solution that worked for me. The rest were waste of time. To avoid an error message, use it this way: mysql —help | grep /my.cnf . I am using centos.

Mar 22, 2022 at 3:34

Me too. This one worked for me, but leave off the /. Used: mysql —help | grep cnf result: order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/my.cnf /etc/mysql/my.cnf /opt/homebrew/etc/my.cnf ~/.my.cnf

Oct 6 at 11:52

locate my.cnf whereis my.cnf find . -name my.cnf 

16.7k 8 8 gold badges 49 49 silver badges 57 57 bronze badges
answered Feb 27, 2013 at 8:19
Satish Sharma Satish Sharma
3,284 9 9 gold badges 38 38 silver badges 51 51 bronze badges
Great mine was at /etc/mysql/my.cnf in Ubuntu 12.0.1 on EC2
May 28, 2013 at 2:02

whereis won’t work here; it searches for the locations corresponding to a command, and can’t find arbitrary files.

Nov 10, 2015 at 12:05
And updatedb to update the list locate goes through — if my.cnf wasn’t indexed
May 3, 2017 at 22:15

This might work:

strace mysql ";" 2>&1 | grep cnf 

on my machine this outputs:

stat64("/etc/my.cnf", 0xbf9faafc) = -1 ENOENT (No such file or directory) stat64("/etc/mysql/my.cnf", ) = 0 open("/etc/mysql/my.cnf", O_RDONLY|O_LARGEFILE) = 3 read(3, "# /etc/mysql/my.cnf: The global ". 4096) = 4096 stat64("/home/xxxxx/.my.cnf", 0xbf9faafc) = -1 ENOENT (No such file or directory) 

So it looks like /etc/mysql/my.cnf is the one since it stat64() and read() were successful.

answered Mar 22, 2010 at 18:13
Chuck Ross Chuck Ross
306 2 2 silver badges 2 2 bronze badges

By default, mysql search my.cnf first at /etc folder. If there is no /etc/my.cnf file inside this folder, I advise you to create new one in this folder as indicated by the documentation (https://dev.mysql.com/doc/refman/5.6/en/option-files.html).

You can also search for existing my.cnf furnished by your mysql installation. You can launch the following command

sudo find / -name "*.cnf" 

You can use the following configuration file with myisam table and without innodb mysql support (from port installation of mysql on mac os x maverick). Please verify each command in this configuration file.

# Example MySQL config file for large systems. # # This is for a large system with memory = 512M where the system runs mainly # MySQL. # # MySQL programs look for option files in a set of # locations which depend on the deployment platform. # You can copy this option file to one of those # locations. For information about these locations, see: # http://dev.mysql.com/doc/mysql/en/option-files.html # # In this file, you can use all long options that a program supports. # If you want to know which options a program supports, run the program # with the "--help" option. # The following options will be passed to all MySQL clients [client] #password = your_password port = 3306 socket = /opt/local/var/run/mysql5/mysqld.sock # Here follows entries for some specific programs # The MySQL server [mysqld] port = 3306 socket = /opt/local/var/run/mysql5/mysqld.sock skip-locking key_buffer_size = 256M max_allowed_packet = 1M table_open_cache = 256 sort_buffer_size = 1M read_buffer_size = 1M read_rnd_buffer_size = 4M myisam_sort_buffer_size = 64M thread_cache_size = 8 query_cache_size= 16M # Try number of CPU's*2 for thread_concurrency thread_concurrency = 8 # Don't listen on a TCP/IP port at all. This can be a security enhancement, # if all processes that need to connect to mysqld run on the same host. # All interaction with mysqld must be made via Unix sockets or named pipes. # Note that using this option without enabling named pipes on Windows # (via the "enable-named-pipe" option) will render mysqld useless! # #skip-networking # Replication Master Server (default) # binary logging is required for replication log-bin=mysql-bin # binary logging format - mixed recommended binlog_format=mixed # required unique id between 1 and 2^32 - 1 # defaults to 1 if master-host is not set # but will not function as a master if omitted server-id = 1 # Replication Slave (comment out master section to use this) # # To configure this host as a replication slave, you can choose between # two methods : # # 1) Use the CHANGE MASTER TO command (fully described in our manual) - # the syntax is: # # CHANGE MASTER TO MASTER_HOST=, MASTER_PORT=, # MASTER_USER=, MASTER_PASSWORD= ; # # where you replace , , by quoted strings and # by the master's port number (3306 by default). # # Example: # # CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306, # MASTER_USER='joe', MASTER_PASSWORD='secret'; # # OR # # 2) Set the variables below. However, in case you choose this method, then # start replication for the first time (even unsuccessfully, for example # if you mistyped the password in master-password and the slave fails to # connect), the slave will create a master.info file, and any later # change in this file to the variables' values below will be ignored and # overridden by the content of the master.info file, unless you shutdown # the slave server, delete master.info and restart the slaver server. # For that reason, you may want to leave the lines below untouched # (commented) and instead use CHANGE MASTER TO (see above) # # required unique id between 2 and 2^32 - 1 # (and different from the master) # defaults to 2 if master-host is set # but will not function as a slave if omitted #server-id = 2 # # The replication master for this slave - required #master-host = # # The username the slave will use for authentication when connecting # to the master - required #master-user = # # The password the slave will authenticate with when connecting to # the master - required #master-password = # # The port the master is listening on. # optional - defaults to 3306 #master-port = # # binary logging - not required for slaves, but recommended #log-bin=mysql-bin # Uncomment the following if you are using InnoDB tables #innodb_data_home_dir = /opt/local/var/db/mysql5 #innodb_data_file_path = ibdata1:10M:autoextend #innodb_log_group_home_dir = /opt/local/var/db/mysql5 # You can set .._buffer_pool_size up to 50 - 80 % # of RAM but beware of setting memory usage too high #innodb_buffer_pool_size = 256M #innodb_additional_mem_pool_size = 20M # Set .._log_file_size to 25 % of buffer pool size #innodb_log_file_size = 64M #innodb_log_buffer_size = 8M #innodb_flush_log_at_trx_commit = 1 #innodb_lock_wait_timeout = 50 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [myisamchk] key_buffer_size = 128M sort_buffer_size = 128M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout 

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *