+1 to what Howard said ... don't edit/change core code.
While that help link wasn't all that helpeful, could be because such an error is pretty generic so nothing could be written in the help that was 100% on target ... so let's look a what might have happened (did to me - and you might have done the same thing I did!):
When your site was a 3.1, did you update the component in Environment check and check environment? Did that show any 'must fix'. Versions are not the issue with DB - it's engine/collation with the DB server and the DB for the Moodle.
Check the version.php file in moodle code. There is a line in there that tells what version of the code is present. What does the '$release' line say.
And there has been added a new line in fresh installs of 3.3 ...
actually an array of *options* for the database. Here's a clip from config-dist.php of a working site:
$CFG->dboptions = array(
'dbpersist' => false, // should persistent database connections be
// used? set to 'false' for the most stable
// setting, 'true' can improve performance
// sometimes
'dbsocket' => false, // should connection via UNIX socket be used?
// if you set it to 'true' or custom path
// here set dbhost to 'localhost',
// (please note mysql is always using socket
// if dbhost is 'localhost' - if you need
// local port connection use '127.0.0.1')
'dbport' => '', // the TCP port number to use when connecting
// to the server. keep empty string for the
// default port
'dbhandlesoptions' => false,// On PostgreSQL poolers like pgbouncer don't
// support advanced options on connection.
// If you set those in the database then
// the advanced settings will not be sent.
'dbcollation' => 'utf8mb4_unicode_ci', // MySQL has partial and full UTF-8
// support. If you wish to use partial UTF-8
// (three bytes) then set this option to
'spirit of sharing', Ken