Upgrade from 3.5.2 to 3.6.2 - can't read database

Upgrade from 3.5.2 to 3.6.2 - can't read database

by Marco Lazzarotto -
Number of replies: 1

Hello, I'm simulating the upgrade process from Moodle 3.5.2 to 3.6.2.

My test setup is: Ubuntu 16.04, Apache 2.4.18, MariaDB 10.0.36 and PHP 7.0.32.

This is the steps I follow:

  1. copy of the production folders moodle (3.5.2) and moodledata
  2. import of the dump of the production db
  3. edit of the configuration.php file
  4. everything works as expected
  5. rename the moodle folder in moodle_3.5.2
  6. unzip the new moodle zip
  7. copy of the theme folder, the images folder and the configuration.php
  8. set the right ownership of the moodle and moodledata folders

Now if I browse moodle, the error page says that it can't talk to the database. Note that between the 3.5.2 and the 3.6.2 the db is not modified at all.

I attach the error.log of Apache


can't connect to db error

Average of ratings: -
In reply to Marco Lazzarotto

Re: Upgrade from 3.5.2 to 3.6.2 - can't read database

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

The log file suggests that the Moodle 3.6.2 source code is trying to use the Moodle 3.5.2 database without first upgrading it.

When you change to the Moodle 3.6.2 source code folder it should detect the version from the database, see the older version and redirect to the upgrade page -- /admin/index.php -- which says "Upgrading Moodle database from version 3.5.2 (Build: 20180910) (2018051702.00) to 3.6.2 (Build: 20190114) (2018120302.00)". Did that not happen?

Check the version in the database, e.g. with SELECT name, value mdl FROM_config WHERE name = 'version'. If it's 3.5.2 it should be "2018051702", if it's 3.6.2 it would be "2018120302". But if it is 3.6.2 something went wrong because the database is missing some changes that should be performed by the upgrade.

You can perform the upgrade from the command line so it could be worth trying but you may get the same results.

If the database thinks it is 3.6.2 but you're still getting this error I would start the upgrade process from scratch and note any errors or unusual messages.

Average of ratings: Useful (1)