Posts

Showing posts from September, 2023

breaks during database upgrade saying database table already exists

 If moodle breaks during database upgrade saying "database table already exists", you basically have no choice but to drop that table. My suggestion is to backup the database first: mysqldump moodle > moodle.sql Then use vi editor to locate that table and save that code separately. Obviously if the table is empty it doesn't matter. To find out if the table is empty, go back into mysql and type use moodle; select * from tablename; If it returns zero results, you are in luck, you can just drop the table: drop table tablename; But if it contains some stuff, then you have to save it and reload it later using mysqldump and then  mysql. Something like this: Assuming you've saved it as shown above and assuming you've kept only the SQL of that table; mysql moodle < mytablesql.sql Anyway, back on to the point. Once you have dropped the table, go back to the installer webpage, click in the URL bar where it shows the moodle webserver address, and just press Enter. Do n

turn on debug mode moodle

 in config.php after declaration of the CFG variable: @error_reporting (E_ALL | E_STRICT); @ini_set ('display_errors', '1'); $CFG->debug = (E_ALL | E_STRICT); $CFG->debugdisplay = 1;

database text format inconsistencies

When you create the moodle database, use something like this: mysql > create database moodle collate utf8mb4_unicode_ci; And when you set up the config.php file, make sure the line "dbcollation" mentions the same text format (utf8mb4_unicode_ci). To check what text collation you used, in mysql, type: SELECT @@character_set_database, @@collation_database; If you don't do this, you might have to edit        vi /var/www/html/moodle/lib/dml/mysqli_native_moodle_database.php and change line 196 to read         $sql = "SELECT @@storage_engine engine"; instead of         $sql = "SELECT @@default_storage_engine engine";