run mysql_install_db if datadir is set annd mysql database is missing
This commit is contained in:
parent
4375d76c09
commit
6f5488827a
1 changed files with 13 additions and 0 deletions
|
@ -6,4 +6,17 @@ class mysql::server::install {
|
|||
name => $mysql::server::package_name,
|
||||
}
|
||||
|
||||
# run mysql_install_db if datadir is set and datadir doesn't contain the
|
||||
# mysql database (directory)
|
||||
if $mysql::server::override_options['mysqld'] and $mysql::server::override_options['mysqld']['datadir'] {
|
||||
$mysqluser = $mysql::server::options['mysqld']['user']
|
||||
$datadir = $mysql::server::override_options['mysqld']['datadir']
|
||||
|
||||
exec { "mysql_install_db":
|
||||
command => "mysql_install_db --datadir=$datadir --user=$mysqluser",
|
||||
creates => "$datadir/mysql",
|
||||
logoutput => on_failure,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue