[MDEV-5030] RPM installation not running mysql_install_db if datadir exists Created: 2013-09-18  Updated: 2013-11-12  Resolved: 2013-11-12

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.33
Fix Version/s: 5.5.34

Type: Bug Priority: Minor
Reporter: Will Fong Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None
Environment:

CentOS 6 (haven't looked at the RPM specs for other platforms)



 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:

  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



 Comments   
Comment by Kolbe Kegel (Inactive) [ 2013-09-19 ]

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.

Generated at Thu Feb 08 07:01:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.