MariaDB源码中是否存在包含全部参数默认值的默认my.cnf?
MariaDB's Default Configuration Files: Comparing to PHP's php.ini
Great question! I totally get where you're coming from—having a single, source-controlled default config file (like PHP's php.ini) makes tracking version changes so much easier. Let's break down how MariaDB handles this:
- No single "full default" config file in the source tree: Unlike PHP, MariaDB doesn't ship a complete, all-in-one default configuration file that's kept in sync with every parameter change. Its default settings are actually baked directly into the server binary (
mysqlditself) rather than stored in a standalone file you can easily diff against. - The
debian/additions/my.cnffile is distro-specific: The file you found is maintained by Debian/Ubuntu package maintainers, not the core MariaDB team. It only covers a subset of commonly adjusted parameters, and its updates aren't tied to every MariaDB version release—so it's not reliable for tracking full default config changes.
How to Get the Full Set of Default Parameters
If you want to capture all default values for a MariaDB version (just like you'd get from php.ini), use this command:
mysqld --help --verbose
This will print every configuration parameter and its built-in default value. You can redirect this output to a file for easy storage and comparison:
mysqld --help --verbose > mariadb_defaults_v10.6.txt
Tracking Changes Between Versions
- Hash comparison: Just like you do with
php.ini, you can compute the hash of the exported default parameters file for each version. For example:
If the hashes differ, you know there are changes to investigate.sha256sum mariadb_defaults_v10.6.txt mariadb_defaults_v10.11.txt - Diff tooling: Use
diffto spot exactly which parameters changed between versions:diff mariadb_defaults_v10.6.txt mariadb_defaults_v10.11.txt - Bonus: Distro sample configs: Some Linux distributions include sample config files in
/usr/share/mysql/(likemy-small.cnf,my-medium.cnf). These are starting points for different server sizes, but note they're not the actual built-in defaults—just curated examples.
内容的提问来源于stack exchange,提问作者chingis
相关产品推荐
相关产品推荐

