The postinstall script of the 5.5.33 CentOS 6 bundle checks to see if the data directory exists, and if not, create it and run mysql_install_db:
if [ ! -e $datadir ]; then
# Create data directory
mkdir -p $datadir/{mysql,test}
# Initiate databases
/usr/bin/mysql_install_db --rpm --user=mysql
fi
This prevents mysql_install_db from running if $datadir exists but is empty. An example of this situation is when $datadir is a separate partition, or perhaps someone wanted to do a fresh install and does "rm -rf /var/lib/mysql/*".
I believe checking for $datadir/mysql would be a more accurate check, since that must exist or something really bad has happened.
Thanks,
-will
Will Fong
made changes -
2013-09-18 08:43
Field
Original Value
New Value
Description
The postinstall script of the 5.5.33 CentOS 6 bundle checks to see if the data directory exists, and if not, create it and run mysql_install_db:
{code}
if [ ! -e $datadir ]; then
# Create data directory
mkdir -p $datadir/{mysql,test}
# Initiate databases
/usr/bin/mysql_install_db --rpm --user=mysql
fi
{code}
This prevents mysql_install_db from running if $datadir exists but is empty. An example of this situation is when $datadir is a separate partition, or perhaps someone wants to do a fresh install and does "rm -rf /var/lib/mysql/*".
I believe checking for $datadir/mysql would be a more accurate check, since that must exist or something really bad has happened.
Thanks,
-will
The postinstall script of the 5.5.33 CentOS 6 bundle checks to see if the data directory exists, and if not, create it and run mysql_install_db:
{code}
if [ ! -e $datadir ]; then
# Create data directory
mkdir -p $datadir/{mysql,test}
# Initiate databases
/usr/bin/mysql_install_db --rpm --user=mysql
fi
{code}
This prevents mysql_install_db from running if $datadir exists but is empty. An example of this situation is when $datadir is a separate partition, or perhaps someone wanted to do a fresh install and does "rm -rf /var/lib/mysql/*".
I believe checking for $datadir/mysql would be a more accurate check, since that must exist or something really bad has happened.
Thanks,
-will
Sergei Golubchik
made changes -
2013-09-18 17:20
Assignee
Sergei Golubchik
[ serg
]
Sergei Golubchik
made changes -
2013-09-20 18:22
Fix Version/s
5.5.34
[ 13700
]
Fix Version/s
5.5.33a
[ 13500
]
Sergei Golubchik
made changes -
2013-11-07 21:52
Status
Open
[ 1
]
In Progress
[ 3
]
Sergei Golubchik
made changes -
2013-11-12 14:29
Resolution
Fixed
[ 1
]
Status
In Progress
[ 3
]
Closed
[ 6
]
Sergei Golubchik
made changes -
2014-06-13 15:06
Workflow
defaullt
[ 29017
]
MariaDB v2
[ 43347
]
Sergei Golubchik
made changes -
2021-12-06 21:39
Workflow
MariaDB v3
[ 62434
]
MariaDB v4
[ 147042
]
{"report":{"fcp":1089.8999996185303,"ttfb":365.0999994277954,"pageVisibility":"visible","entityId":25717,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"79fecf73-0c41-43a7-8d30-eabe0bb19bfa","navigationType":0,"readyForUser":1154.3999996185303,"redirectCount":0,"resourceLoadedEnd":997.0999994277954,"resourceLoadedStart":371.19999980926514,"resourceTiming":[{"duration":178.89999961853027,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":371.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":371.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":550.0999994277954,"responseStart":0,"secureConnectionStart":0},{"duration":179,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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":371.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":371.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":550.5,"responseStart":0,"secureConnectionStart":0},{"duration":187.60000038146973,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":371.69999980926514,"connectEnd":371.69999980926514,"connectStart":371.69999980926514,"domainLookupEnd":371.69999980926514,"domainLookupStart":371.69999980926514,"fetchStart":371.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":371.69999980926514,"responseEnd":559.3000001907349,"responseStart":559.3000001907349,"secureConnectionStart":371.69999980926514},{"duration":246.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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":371.8999996185303,"connectEnd":371.8999996185303,"connectStart":371.8999996185303,"domainLookupEnd":371.8999996185303,"domainLookupStart":371.8999996185303,"fetchStart":371.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":371.8999996185303,"responseEnd":618.1999998092651,"responseStart":618.1999998092651,"secureConnectionStart":371.8999996185303},{"duration":250.20000076293945,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":372.0999994277954,"connectEnd":372.0999994277954,"connectStart":372.0999994277954,"domainLookupEnd":372.0999994277954,"domainLookupStart":372.0999994277954,"fetchStart":372.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":372.0999994277954,"responseEnd":622.3000001907349,"responseStart":622.3000001907349,"secureConnectionStart":372.0999994277954},{"duration":250.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":372.30000019073486,"connectEnd":372.30000019073486,"connectStart":372.30000019073486,"domainLookupEnd":372.30000019073486,"domainLookupStart":372.30000019073486,"fetchStart":372.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":372.30000019073486,"responseEnd":622.8000001907349,"responseStart":622.8000001907349,"secureConnectionStart":372.30000019073486},{"duration":251.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":372.3999996185303,"connectEnd":372.3999996185303,"connectStart":372.3999996185303,"domainLookupEnd":372.3999996185303,"domainLookupStart":372.3999996185303,"fetchStart":372.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":372.3999996185303,"responseEnd":623.6999998092651,"responseStart":623.6999998092651,"secureConnectionStart":372.3999996185303},{"duration":335.1000003814697,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":372.5999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":372.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":707.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":251.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":372.80000019073486,"connectEnd":372.80000019073486,"connectStart":372.80000019073486,"domainLookupEnd":372.80000019073486,"domainLookupStart":372.80000019073486,"fetchStart":372.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":372.80000019073486,"responseEnd":624.5,"responseStart":624.5,"secureConnectionStart":372.80000019073486},{"duration":334.8999996185303,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/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":373,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":373,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":707.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":252,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/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":373.19999980926514,"connectEnd":373.19999980926514,"connectStart":373.19999980926514,"domainLookupEnd":373.19999980926514,"domainLookupStart":373.19999980926514,"fetchStart":373.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":373.19999980926514,"responseEnd":625.1999998092651,"responseStart":625.1999998092651,"secureConnectionStart":373.19999980926514},{"duration":386,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":379,"connectEnd":379,"connectStart":379,"domainLookupEnd":379,"domainLookupStart":379,"fetchStart":379,"redirectEnd":0,"redirectStart":0,"requestStart":379,"responseEnd":765,"responseStart":765,"secureConnectionStart":379},{"duration":436.3999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":379,"connectEnd":379,"connectStart":379,"domainLookupEnd":379,"domainLookupStart":379,"fetchStart":379,"redirectEnd":0,"redirectStart":0,"requestStart":379,"responseEnd":815.3999996185303,"responseStart":815.3000001907349,"secureConnectionStart":379},{"duration":46.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":720.3000001907349,"connectEnd":720.3000001907349,"connectStart":720.3000001907349,"domainLookupEnd":720.3000001907349,"domainLookupStart":720.3000001907349,"fetchStart":720.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":720.3000001907349,"responseEnd":766.8000001907349,"responseStart":766.8000001907349,"secureConnectionStart":720.3000001907349},{"duration":206.39999961853027,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bu7/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":790.6999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":790.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":997.0999994277954,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":103,"responseStart":365,"responseEnd":375,"domLoading":369,"domInteractive":1208,"domContentLoadedEventStart":1208,"domContentLoadedEventEnd":1254,"domComplete":1690,"loadEventStart":1690,"loadEventEnd":1691,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1186.3999996185303},{"name":"bigPipe.sidebar-id.end","time":1187.1999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1187.3999996185303},{"name":"bigPipe.activity-panel-pipe-id.end","time":1190.5999994277954},{"name":"activityTabFullyLoaded","time":1286.3000001907349}],"measures":[],"correlationId":"78d61818d34cb0","effectiveType":"4g","downlink":9.8,"rtt":0,"serverDuration":189,"dbReadsTimeInMs":73,"dbConnsTimeInMs":83,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
This is a problem in an environment where a user has mounted some separate device as /var/lib/mysql to serve as the datadir. In that scenario, the directory will exist before the RPM is installed, but it won't contain anything. The script should perhaps look for /var/lib/mysql/mysql or even look for some specific privilege table(s) to determine whether it is necessary to run mysql_install_db.