Что такое формат файла CNF?
.cnf is a configuration file associated with the MySQL relational database and its compatible fork MariaDB. .cnf files store database startup options in plain text, using an INI-style [section] key = value syntax. The canonical file is my.cnf, typically located in /etc/my.cnf or /etc/mysql/my.cnf on Linux and macOS systems. On Windows, the equivalent file is usually named my.ini.
.cnf files define database parameters such as buffer size, cache settings, character encoding, and network options. One of the most important settings is the wait_timeout parameter, which determines how long the server waits before closing an inactive connection - this is especially important for large databases and applications that use complex queries. Other directives control the InnoDB buffer pool, binary logging, and maximum connection limits.
MySQL reads option files from a documented set of paths in order, with settings in later files overriding earlier ones. The !include and !includedir directives allow splitting configuration across multiple .cnf files.
MySQL is the most popular relational database management system, widely used for websites, enterprise applications, and cloud deployments. It is free and open-source technology maintained by Oracle. MariaDB, a community fork, uses the same .cnf option-file syntax and is equally prevalent on Linux servers.
Безопасность и защита
РИСК: MEDIUMThe file is safe to read, but two real cautions apply. (1) Editing risk: an invalid option or typo in [mysqld] is a common cause of "MySQL won't start" - back up the file, change one option at a time, and validate before restarting. (2) Credential exposure: .cnf files (especially ~/.my.cnf) often store database usernames and passwords in clear text, so restrict file permissions (chmod 600) and never commit one to a public repository. Treat downloaded "optimized my.cnf" tuning files cautiously - verify the options suit your server's RAM and version.
Детали формата
в двух словах- OpenVPN configuration / certificate file - Some OpenVPN and OpenSSL setups use .cnf for config or certificate-request settings (e.g. openssl.cnf).
- MAME / arcade emulator config - MAME and some emulators write per-game .cnf settings files.
- Generic application config - Various programs reuse .cnf as a plain-text settings file unrelated to MySQL.
Программы, открывающие файлы CNF
Технические подробности
глубокая спецификация| File format | Plain-text INI-style option file with no binary encoding |
| Syntax structure | Section headers such as [mysqld] or [client] each containing key = value option lines |
| Character encoding | ASCII / UTF-8 |
| Typical file size | 1 KB - 30 KB |
| Canonical filename | my.cnf on Linux and macOS; my.ini on Windows (same syntax, different name) |
| Default search paths | /etc/my.cnf, /etc/mysql/my.cnf, ~/.my.cnf - read in documented order; later file overrides earlier |
| Section groups | [mysqld], [client], [mysqldump], [mysqld_safe], [mysql] |
| Include directives | !include and !includedir let administrators split configuration across multiple files |
| Comment syntax | Lines beginning with # or ; |
| Security consideration | May contain database passwords in plain text - protect with chmod 600 on Unix systems |
| MIME type | text/plain |
| File signature | None - identified by INI-style section headers like [mysqld], not a binary byte signature |
| Compatible products | MySQL 5.x / 8.x and MariaDB 10.x / 11.x - both use identical option-file syntax |
| Key options configured | innodb_buffer_pool_size, wait_timeout, max_connections, character-set-server, bind-address |
| Compression | None - always stored as uncompressed plain text |
| Developer | Oracle Corporation (MySQL) and the MariaDB Foundation |
| Выпущен | MySQL option files, mid-1990s (my.cnf on Unix; my.ini on Windows) |
| Последняя версия | Ongoing - same INI option-file syntax across MySQL 8.x and MariaDB 11.x |
| Открыть стандартное | Да · без роялти |
| Спецификация | dev.mysql.com |
Конвертации CNF
Вопросы и ответы сообщества
спрошено пользователямиВопросов пока нет - станьте первым, кто спросит о файлах CNF.