什么时候该用这个 50-mysqld_safe.cnf?
用来恢复缺失的默认文件、确认发行版本带了什么,或拿你的 MariaDB config 做 diff。
# 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 https://exampleconfig.com/api/v1/config/original/ae130218a23989c3a504c95831610b4b?hint=50-mysqld_safe.cnf
wget -O 50-mysqld_safe.cnf https://exampleconfig.com/api/v1/config/original/ae130218a23989c3a504c95831610b4b?hint=50-mysqld_safe.cnf
<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>Ubuntu 24.04 LTS (Noble Numbat)</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 助手里。
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
什么时候该用这个 50-mysqld_safe.cnf?
用来恢复缺失的默认文件、确认发行版本带了什么,或拿你的 MariaDB config 做 diff。
怎么恢复 MariaDB 的默认配置?
下载文件,把 /etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf 里的当前配置备份好,替换掉,然后 reload 或 restart MariaDB。
50-mysqld_safe.cnf 适合直接上生产吗?
这是 Ubuntu 24.04 LTS (Noble Numbat) 的厂商默认配置,只能当基线。上生产前请检查安全和性能设置。
和其他 OS 版本有什么不同?
默认值会随发行版和版本变化,这份对应 Ubuntu 24.04 LTS (Noble Numbat)。
我可以用它来排查 MariaDB 吗?
可以。和你的配置做 diff 找出漂移,然后只恢复需要的段落。