DDL sql execution error while upgrading from Moodle 3.4 to Moodle 3.5.1+ (SOLVED).
Here is the solution to DDL sql execution error ,while upgrading the Moodle 3.4 to Moodle 3.5.1+. The following is the copy of the error.
SOLUTION:
1. Go to moodle root folder: cd /var/www/html/moodle
2. vim config.php //open the config file
1 <?php // Moodle configuration file
2
On the config.php page, line no. 13 change the
$CFG->prefix = 'mdl_'; to $CFG->prefix = 'mdl2_';
Refresh the page and you are good to go.
Upgrading to new
version
search_simpledb
DDL
sql execution error
×Debug
info: Table 'mdl_search_simpledb_index' already exists
CREATE TABLE mdl_search_simpledb_index (
id BIGINT(10) NOT NULL auto_increment,
docid VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
itemid BIGINT(10) NOT NULL,
title LONGTEXT COLLATE utf8mb4_unicode_ci,
content LONGTEXT COLLATE utf8mb4_unicode_ci,
contextid BIGINT(10) NOT NULL,
areaid VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
type TINYINT(1) NOT NULL,
courseid BIGINT(10) NOT NULL,
owneruserid BIGINT(10),
modified BIGINT(10) NOT NULL,
userid BIGINT(10),
description1 LONGTEXT COLLATE utf8mb4_unicode_ci,
description2 LONGTEXT COLLATE utf8mb4_unicode_ci,
CONSTRAINT PRIMARY KEY (id)
, KEY mdl_searsimpinde_owncon2_ix (owneruserid, contextid)
, UNIQUE KEY mdl_searsimpinde_doc2_uix (docid)
)
ENGINE = InnoDB
DEFAULT COLLATE = utf8mb4_unicode_ci ROW_FORMAT=Compressed
COMMENT='search_simpledb table containing the index data.'
Error code: ddlexecuteerror
CREATE TABLE mdl_search_simpledb_index (
id BIGINT(10) NOT NULL auto_increment,
docid VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
itemid BIGINT(10) NOT NULL,
title LONGTEXT COLLATE utf8mb4_unicode_ci,
content LONGTEXT COLLATE utf8mb4_unicode_ci,
contextid BIGINT(10) NOT NULL,
areaid VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
type TINYINT(1) NOT NULL,
courseid BIGINT(10) NOT NULL,
owneruserid BIGINT(10),
modified BIGINT(10) NOT NULL,
userid BIGINT(10),
description1 LONGTEXT COLLATE utf8mb4_unicode_ci,
description2 LONGTEXT COLLATE utf8mb4_unicode_ci,
CONSTRAINT PRIMARY KEY (id)
, KEY mdl_searsimpinde_owncon2_ix (owneruserid, contextid)
, UNIQUE KEY mdl_searsimpinde_doc2_uix (docid)
)
ENGINE = InnoDB
DEFAULT COLLATE = utf8mb4_unicode_ci ROW_FORMAT=Compressed
COMMENT='search_simpledb table containing the index data.'
Error code: ddlexecuteerror
×Stack
trace:
·
line
492 of /lib/dml/moodle_database.php: ddl_change_structure_exception thrown
·
line
1070 of /lib/dml/mysqli_native_moodle_database.php: call to
moodle_database->query_end()
·
line
77 of /lib/ddl/database_manager.php: call to
mysqli_native_moodle_database->change_database_structure()
·
line
425 of /lib/ddl/database_manager.php: call to database_manager->execute_sql_arr()
·
line
370 of /lib/ddl/database_manager.php: call to
database_manager->install_from_xmldb_structure()
·
line
594 of /lib/upgradelib.php: call to
database_manager->install_from_xmldb_file()
·
line
1857 of /lib/upgradelib.php: call to upgrade_plugins()
·
line
694 of /admin/index.php: call to upgrade_noncore()
1. Go to moodle root folder: cd /var/www/html/moodle
2. vim config.php //open the config file
1 <?php // Moodle configuration file
2
3 unset($CFG);
4 global $CFG;
5 $CFG = new stdClass();
6
7 $CFG->dbtype = 'mysqli';
8 $CFG->dblibrary = 'native';
9 $CFG->dbhost = 'localhost';
10 $CFG->dbname = 'moodledb';
11 $CFG->dbuser = 'username';
12 $CFG->dbpass = 'password123';
13 $CFG->prefix = 'mdl2_';
14 $CFG->dboptions = array (
15 'dbpersist' => 0,
16 'dbport' => '',
17 'dbsocket' => '',
18 'dbcollation' => 'utf8mb4_unicode_ci',);
20
21 $CFG->wwwroot = 'https://moodle.xxx.edu.bt';
22 $CFG->dataroot = '/var/mdata/moodledata';
23 $CFG->admin = 'admin';
24
25 $CFG->directorypermissions = 0777;
26
27 require_once(__DIR__ . '/lib/setup.php');
28
29 // There is no php closing tag in this file,
30 // it is intentional because it prevents trailing whitespace problems!
~
$CFG->prefix = 'mdl_'; to $CFG->prefix = 'mdl2_';
Refresh the page and you are good to go.
Well, not really, the result will be a completely empty installation and you will start configuration from scratch. You would also need to clean up all the old mdl_ tables from the database. The error is most likely there because of a failed upgrade in the past where orphaned tables were created and left behind, you would be better to rename the table and continue with the upgrade, if everything works OK, you can drop those renamed tables.
ReplyDeleteEjeuctar desde una ventana de SQL en phpMyAdmin el siguiente comando
DeleteSET GLOBAL innodb_read_only_compressed=OFF;