MariaDB /etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf

原始 📋 Debian 11 (Bullseye) 28 行

适用于

当前查看:
Debian 11 (Bullseye)
相同于:
Debian 12 (Bookworm) Debian 13 (Trixie) Ubuntu 22.04 LTS (Jammy Jellyfish) Ubuntu 24.04 LTS (Noble Numbat)
其他版本:

详情

大小
28 行
MD5
ae130218a23989c3a504c95831610b4b
SHA256
bfc648f510483468aeefdd9256089a89e278d06b19945c368e4e846fe53797e1
/etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf
# NOTE: THIS FILE IS READ ONLY BY THE TRADITIONAL SYSV INIT SCRIPT, NOT SYSTEMD.
# MARIADB SYSTEMD DOES _NOT_ UTILIZE MYSQLD_SAFE NOR READ THIS FILE.
#
# For similar behavior, systemd users should create the following file:
# /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf
#
# To achieve the same result as the default 50-mysqld_safe.cnf, please create
# /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf
# with the following contents:
#
# [Service]
# User = mysql
# StandardOutput = syslog
# StandardError = syslog
# SyslogFacility = daemon
# SyslogLevel = err
# SyslogIdentifier = mysqld
#
# For more information, please read https://mariadb.com/kb/en/mariadb/systemd/

[mysqld_safe]
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# especially if they contain "#" chars...

nice = 0
skip_log_error
syslog

复制粘贴

curl:
curl https://exampleconfig.com/api/v1/config/original/ae130218a23989c3a504c95831610b4b?hint=50-mysqld_safe.cnf
wget:
wget -O 50-mysqld_safe.cnf https://exampleconfig.com/api/v1/config/original/ae130218a23989c3a504c95831610b4b?hint=50-mysqld_safe.cnf

给 AI Agent 用

<prompt><role>DevOps agent</role><source url='https://exampleconfig.com/api/v1/config/original/ae130218a23989c3a504c95831610b4b?hint=50-mysqld_safe.cnf' /><config><app>MariaDB</app><os>Debian 11 (Bullseye)</os><location>/etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf</location><lines>28</lines><md5>ae130218a23989c3a504c95831610b4b</md5><sha256>bfc648f510483468aeefdd9256089a89e278d06b19945c368e4e846fe53797e1</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/mariadb.conf.d/50-mysqld_safe.cnf
目录
/etc/mysql/mariadb.conf.d/
用途
系统级配置目录
说明
/etc/ 里的文件是系统级配置,影响所有用户。

FAQ

什么时候该用这个 50-mysqld_safe.cnf?

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

怎么恢复 MariaDB 的默认配置?

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

50-mysqld_safe.cnf 适合直接上生产吗?

这是 Debian 11 (Bullseye) 的厂商默认配置,只能当基线。上生产前请检查安全和性能设置。

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

默认值会随发行版和版本变化,这份对应 Debian 11 (Bullseye)。

我可以用它来排查 MariaDB 吗?

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