diff --git a/install/update.php b/install/update.php index 42ddd625f5aca69cebcf2b8d1c8064d1b1735ba2..11570aa666ece7bd14c272c521f6c29af2c27536 100644 --- a/install/update.php +++ b/install/update.php @@ -293,6 +293,22 @@ if($conf['mysql']['master_slave_setup'] == 'y') { */ checkDbHealth(); + +/* + * Check command line mysql login + */ +if( !empty($conf["mysql"]["admin_password"]) ) { + $cmd = "mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -P ".escapeshellarg($conf['mysql']['port'])." -D ".escapeshellarg($conf['mysql']['database'])." -e ". escapeshellarg('SHOW DATABASES'); +} else { + $cmd = "mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -P ".escapeshellarg($conf['mysql']['port'])." -D ".escapeshellarg($conf['mysql']['database'])." -e ". escapeshellarg('SHOW DATABASES'); +} +$retval = 0; +$retout = array(); +exec($cmd, $retout, $retval); +if($retval != 0) { + die("Unable to call mysql command line with credentials from mysql_clientdb.conf\n"); +} + /* * dump the new Database and reconfigure the server.ini */