The MySQL Config File
Robert Cooper
Robert Cooper Senior Engineer at Basedash
· January 31, 2025
Robert Cooper
Robert Cooper Senior Engineer at Basedash
· January 31, 2025
MySQL’s configuration file, often referred to as my.cnf or my.ini, is a critical file for managing server behavior. It allows you to customize settings to optimize performance, security, and other aspects of MySQL operations.
MySQL reads several configuration files upon startup, and the specific file locations may vary depending on the operating system. The main configuration file is typically named my.cnf on Linux and macOS, or my.ini on Windows.
/etc/my.cnf, /etc/mysql/my.cnf, ~/.my.cnfC:\\ProgramData\\MySQL\\MySQL Server x.x\\my.ini[mysqld]: Server-specific parameters.[mysqld_safe]: Parameters for the mysqld_safe script.[client]: Options for all client programs.[mysql]: Specific options for the mysql client.[mysqld]
port = 3306
socket = /tmp/mysql.sock
key_buffer_size = 16M
max_allowed_packet = 8M
port: Specifies the port MySQL server listens on.socket: Location of the socket file used for local connections.key_buffer_size: Size of the buffer used for index blocks.max_allowed_packet: Maximum size of packets sent between the server and clients.query_cache_size = 32M
table_open_cache = 2000
innodb_buffer_pool_size = 1G
innodb_log_file_size = 256M
query_cache_size: Memory allocated for caching query results.table_open_cache: Number of open tables for all threads.innodb_buffer_pool_size: Size of the buffer pool for InnoDB tables.innodb_log_file_size: Size of each log file in a log group for InnoDB.[mysqld]
local_infile = 0
local_infile: Disables the use of LOAD DATA LOCAL INFILE to prevent data loading from arbitrary files.[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
general_log = 1
general_log_file = /var/log/mysql/mysql.log
log_error = /var/log/mysql/error.log
general_log: Enables general query logging.log_error: Specifies the error log file location.!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
!includedir.Basedash is built as an AI-native BI platform, so teams can go from ad hoc SQL to trusted answers and dashboards quickly, without the overhead of traditional BI setup.
Written by
Senior Engineer at Basedash
Robert Cooper is a senior engineer at Basedash who builds full-stack product systems across SQL data infrastructure, APIs, and frontend architecture. His work focuses on application performance, developer velocity, and reliable self-hosted workflows that make data operations easier for teams at scale.
Basedash lets you build charts, dashboards, and reports in seconds using all your data.