什么时候该用这个 mariadb-server.cnf?
用来恢复缺失的默认文件、确认发行版本带了什么,或拿你的 MariaDB config 做 diff。
# # These groups are read by MariaDB server. # Use it for options that only the server (but not clients) should see # this is read by the standalone daemon and embedded servers [server] # this is only for the mysqld standalone daemon [mysqld] skip-networking # Galera-related settings [galera] # Mandatory settings #wsrep_on=ON #wsrep_provider= #wsrep_cluster_address= #binlog_format=row #default_storage_engine=InnoDB #innodb_autoinc_lock_mode=2 # # Allow server to accept connections on all interfaces. # #bind-address=0.0.0.0 # # Optional setting #wsrep_slave_threads=1 #innodb_flush_log_at_trx_commit=0 # this is only for embedded server [embedded] # This group is only read by MariaDB servers, not by MySQL. # If you use the same .cnf file for MySQL and MariaDB, # you can put MariaDB-only options here [mariadb] # This group is only read by MariaDB-10.5 servers. # If you use the same .cnf file for MariaDB of different versions, # use this group for options that older servers don't understand [mariadb-10.5]
curl https://exampleconfig.com/api/v1/config/original/5afd2a146af8f6f1b8be87075679c44c?hint=mariadb-server.cnf
wget -O mariadb-server.cnf https://exampleconfig.com/api/v1/config/original/5afd2a146af8f6f1b8be87075679c44c?hint=mariadb-server.cnf
<prompt><role>DevOps agent</role><source url='https://exampleconfig.com/api/v1/config/original/5afd2a146af8f6f1b8be87075679c44c?hint=mariadb-server.cnf' /><config><app>MariaDB</app><os>Alpine Linux v3.21</os><location>/etc/my.cnf.d/mariadb-server.cnf</location><lines>42</lines><md5>5afd2a146af8f6f1b8be87075679c44c</md5><sha256>bb0344dbfadffb95c89e1b5e0ee375e0a9a357e57a92fcb5b2801eedbcda869c</sha256></config></prompt>
粘贴到 Claude、ChatGPT 或任何 AI 助手里。
sudo apk add mariadb
sudo apt update && sudo apt install mariadb-server
sudo yum install mariadb-server
sudo apt update && sudo apt install mariadb-server
什么时候该用这个 mariadb-server.cnf?
用来恢复缺失的默认文件、确认发行版本带了什么,或拿你的 MariaDB config 做 diff。
怎么恢复 MariaDB 的默认配置?
下载文件,把 /etc/my.cnf.d/mariadb-server.cnf 里的当前配置备份好,替换掉,然后 reload 或 restart MariaDB。
mariadb-server.cnf 适合直接上生产吗?
这是 Alpine Linux v3.21 的厂商默认配置,只能当基线。上生产前请检查安全和性能设置。
和其他 OS 版本有什么不同?
默认值会随发行版和版本变化,这份对应 Alpine Linux v3.21。
我可以用它来排查 MariaDB 吗?
可以。和你的配置做 diff 找出漂移,然后只恢复需要的段落。