MariaDB /etc/mysql/conf.d/mysql.cnf

原始 📋 Ubuntu 22.04 LTS (Jammy Jellyfish) 30 行

适用于

当前查看:
Ubuntu 22.04 LTS (Jammy Jellyfish)
相同于:
Debian 12 (Bookworm) Ubuntu 20.04 LTS (Focal Fossa) Ubuntu 24.04 LTS (Noble Numbat)
其他版本:

详情

大小
30 行
MD5
a5791297e25094a8322f515e6ee76dfa
SHA256
2e50d13a897dec67bb221e46c518651859007687d29095a3576aad6253e9a98c
/etc/mysql/conf.d/mysql.cnf
# Copyright (c) 2015, 2025, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is designed to work with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation.  The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have either included with
# the program or referenced in the documentation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA

#
# The MySQL  Client configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysql]

复制粘贴

curl:
curl https://exampleconfig.com/api/v1/config/original/a5791297e25094a8322f515e6ee76dfa?hint=mysql.cnf
wget:
wget -O mysql.cnf https://exampleconfig.com/api/v1/config/original/a5791297e25094a8322f515e6ee76dfa?hint=mysql.cnf

给 AI Agent 用

<prompt><role>DevOps agent</role><source url='https://exampleconfig.com/api/v1/config/original/a5791297e25094a8322f515e6ee76dfa?hint=mysql.cnf' /><config><app>MariaDB</app><os>Ubuntu 22.04 LTS (Jammy Jellyfish)</os><location>/etc/mysql/conf.d/mysql.cnf</location><lines>30</lines><md5>a5791297e25094a8322f515e6ee76dfa</md5><sha256>2e50d13a897dec67bb221e46c518651859007687d29095a3576aad6253e9a98c</sha256></config></prompt>

粘贴到 Claude、ChatGPT 或任何 AI 助手里。

安装 MariaDB

Alpine Linux

sudo apk add mariadb

Debian

sudo apt update && sudo apt install mariadb-server

Red Hat Enterprise Linux

sudo yum install mariadb-server

Ubuntu

sudo apt update && sudo apt install mariadb-server

文件位置

文件路径
/etc/mysql/conf.d/mysql.cnf
目录
/etc/mysql/conf.d/
用途
系统级配置目录
说明
/etc/ 里的文件是系统级配置,影响所有用户。

FAQ

什么时候该用这个 mysql.cnf?

用来恢复缺失的默认文件、确认发行版本带了什么,或拿你的 MariaDB config 做 diff。

怎么恢复 MariaDB 的默认配置?

下载文件,把 /etc/mysql/conf.d/mysql.cnf 里的当前配置备份好,替换掉,然后 reload 或 restart MariaDB。

mysql.cnf 适合直接上生产吗?

这是 Ubuntu 22.04 LTS (Jammy Jellyfish) 的厂商默认配置,只能当基线。上生产前请检查安全和性能设置。

和其他 OS 版本有什么不同?

默认值会随发行版和版本变化,这份对应 Ubuntu 22.04 LTS (Jammy Jellyfish)。

我可以用它来排查 MariaDB 吗?

可以。和你的配置做 diff 找出漂移,然后只恢复需要的段落。