From 2a6d7f5536ba0f6f81674a5a908596adb6f3c3d2 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sat, 29 Dec 2007 11:30:52 +0000 Subject: [PATCH] Merged from MOODLE_19_STABLE. Under MySQL, create the db on install if possible. MDL-9609 --- install.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/install.php b/install.php index c6dae5a648..52d19b0df0 100644 --- a/install.php +++ b/install.php @@ -348,14 +348,12 @@ if ($INSTALL['stage'] == DATABASE) { error_reporting(0); // Hide errors if (! $dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'],$INSTALL['dbname'])) { - /// The following doesn't seem to work but we're working on it - /// If you come up with a solution for creating a database in MySQL - /// feel free to put it in and let us know - see MDL-9609 - if ($dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'])) { + $db->database = ''; // reset database name cached by ADODB. Trick from MDL-9609 + if ($dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'])) { /// Try to connect without DB switch ($INSTALL['dbtype']) { /// Try to create a database case 'mysql': case 'mysqli': - if ($db->Execute("CREATE DATABASE {$INSTALL['dbname']};")) { + if ($db->Execute("CREATE DATABASE {$INSTALL['dbname']} DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;")) { $dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'],$INSTALL['dbname']); } else { $errormsg = get_string('dbcreationerror', 'install'); -- 2.39.5