The mysql.server init script doesn't check all server configuration groups. This happens because it uses the following arguments to "my_print_defaults":
/usr/bin/my_print_defaults mysqld server mysql_server mysql.server
See here: https://github.com/MariaDB/server/blob/2db62f686e148f09fe5fd0b385fc71f2a3c4a133/support-files/mysql.server.sh#L213
This causes a problem because the mysql.server script needs to use some of the server configuration options, such as datadir.
For example, let's say we have the following configuration file:
$ cat /etc/my.cnf.d/server.cnf
|
#
|
# These groups are read by MariaDB server.
|
# Use it for options that only the server (but not clients) should see
|
#
|
# See the examples of server my.cnf files in /usr/share/mysql/
|
#
|
|
# this is read by the standalone daemon and embedded servers
|
[server]
|
|
# this is only for the mysqld standalone daemon
|
[mysqld]
|
|
# 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.0 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.0]
|
log_bin
|
binlog_format=ROW
|
server_id=1
|
skip_name_resolve
|
datadir=/exports/mysql
|
What does my_print_defaults give us with the arguments that mysql.server uses? Nothing, because it doesn't check the mariadb-10.0 configuration group:
$ /usr/bin/my_print_defaults mysqld server mysql_server mysql.server
|
If we instead use the --mysqld argument, then it finds the correct settings:
$ /usr/bin/my_print_defaults --mysqld
|
--log_bin
|
--binlog_format=ROW
|
--server_id=1
|
--skip_name_resolve
|
--datadir=/exports/mysql
|
A side-effect of this bug is that you can't set datadir in the mariadb-10.0 configuration group.
$ /usr/bin/my_print_defaults --mysqld | grep "datadir"
|
--datadir=/exports/mysql
|
$ sudo service mysql start
|
Starting MySQL. SUCCESS!
|
$ mysql -u root --execute="SHOW GLOBAL VARIABLES LIKE 'datadir'"
|
+---------------+-----------------+
|
| Variable_name | Value |
|
+---------------+-----------------+
|
| datadir | /var/lib/mysql/ |
|
+---------------+-----------------+
|
{"report":{"fcp":896.6000003814697,"ttfb":282.69999980926514,"pageVisibility":"visible","entityId":52621,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"d7c62635-43bf-4a49-8dfe-9283ef5f55e3","navigationType":0,"readyForUser":972.1999998092651,"redirectCount":0,"resourceLoadedEnd":1645.3999996185303,"resourceLoadedStart":288.5,"resourceTiming":[{"duration":88.10000038146973,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":288.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":288.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":376.6000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":88.09999942779541,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":288.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":288.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":376.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":161,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":289.1000003814697,"connectEnd":289.1000003814697,"connectStart":289.1000003814697,"domainLookupEnd":289.1000003814697,"domainLookupStart":289.1000003814697,"fetchStart":289.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":289.1000003814697,"responseEnd":450.1000003814697,"responseStart":450,"secureConnectionStart":289.1000003814697},{"duration":212.4000005722046,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":289.19999980926514,"connectEnd":289.19999980926514,"connectStart":289.19999980926514,"domainLookupEnd":289.19999980926514,"domainLookupStart":289.19999980926514,"fetchStart":289.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":289.19999980926514,"responseEnd":501.6000003814697,"responseStart":501.6000003814697,"secureConnectionStart":289.19999980926514},{"duration":215.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":289.5,"connectEnd":289.5,"connectStart":289.5,"domainLookupEnd":289.5,"domainLookupStart":289.5,"fetchStart":289.5,"redirectEnd":0,"redirectStart":0,"requestStart":289.5,"responseEnd":505.19999980926514,"responseStart":505.19999980926514,"secureConnectionStart":289.5},{"duration":216,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":289.69999980926514,"connectEnd":289.69999980926514,"connectStart":289.69999980926514,"domainLookupEnd":289.69999980926514,"domainLookupStart":289.69999980926514,"fetchStart":289.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":289.69999980926514,"responseEnd":505.69999980926514,"responseStart":505.69999980926514,"secureConnectionStart":289.69999980926514},{"duration":216.10000038146973,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":289.8999996185303,"connectEnd":289.8999996185303,"connectStart":289.8999996185303,"domainLookupEnd":289.8999996185303,"domainLookupStart":289.8999996185303,"fetchStart":289.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":289.8999996185303,"responseEnd":506,"responseStart":506,"secureConnectionStart":289.8999996185303},{"duration":302.29999923706055,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":290.1000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":290.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":592.3999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":216.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":290.19999980926514,"connectEnd":290.19999980926514,"connectStart":290.19999980926514,"domainLookupEnd":290.19999980926514,"domainLookupStart":290.19999980926514,"fetchStart":290.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":290.19999980926514,"responseEnd":506.3999996185303,"responseStart":506.3999996185303,"secureConnectionStart":290.19999980926514},{"duration":302.20000076293945,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":290.3999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":290.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":592.6000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":216.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":290.6000003814697,"connectEnd":290.6000003814697,"connectStart":290.6000003814697,"domainLookupEnd":290.6000003814697,"domainLookupStart":290.6000003814697,"fetchStart":290.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":290.6000003814697,"responseEnd":507.1000003814697,"responseStart":507.1000003814697,"secureConnectionStart":290.6000003814697},{"duration":1149.2000007629395,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":291.3999996185303,"connectEnd":291.3999996185303,"connectStart":291.3999996185303,"domainLookupEnd":291.3999996185303,"domainLookupStart":291.3999996185303,"fetchStart":291.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":291.3999996185303,"responseEnd":1440.6000003814697,"responseStart":1440.6000003814697,"secureConnectionStart":291.3999996185303},{"duration":1353.8999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":291.5,"connectEnd":291.5,"connectStart":291.5,"domainLookupEnd":291.5,"domainLookupStart":291.5,"fetchStart":291.5,"redirectEnd":0,"redirectStart":0,"requestStart":291.5,"responseEnd":1645.3999996185303,"responseStart":1645.3999996185303,"secureConnectionStart":291.5},{"duration":841.6000003814697,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":603.8999996185303,"connectEnd":603.8999996185303,"connectStart":603.8999996185303,"domainLookupEnd":603.8999996185303,"domainLookupStart":603.8999996185303,"fetchStart":603.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":603.8999996185303,"responseEnd":1445.5,"responseStart":1445.5,"secureConnectionStart":603.8999996185303},{"duration":757.1999998092651,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":890.8000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":890.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1648,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":112,"responseStart":283,"responseEnd":284,"domLoading":286,"domInteractive":1664,"domContentLoadedEventStart":1664,"domContentLoadedEventEnd":1703,"domComplete":2554,"loadEventStart":2554,"loadEventEnd":2556,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1648.8000001907349},{"name":"bigPipe.sidebar-id.end","time":1649.6999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1649.8999996185303},{"name":"bigPipe.activity-panel-pipe-id.end","time":1652.1000003814697},{"name":"activityTabFullyLoaded","time":1724.1000003814697}],"measures":[],"correlationId":"16b8ab1d53a000","effectiveType":"4g","downlink":9.6,"rtt":0,"serverDuration":104,"dbReadsTimeInMs":11,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}