Unable to log in after upgrade

Unable to log in after upgrade

by Andy van der Gugten -
Number of replies: 3
Upgraded to 3.7 and can't log in with local authentication. I get the following error: 

Error writing to database
More information about this error

I did set max_allowed_packet from 32M to 100M but no difference. 

I can log in "once" using Microsoft OAuth - but after that once I have to empty cache and hard reload to log in again. 

I checked with PHPMyAdmin and the database is definitely running and working fine. 

I've turned on debugging but it doesn't display anything other than the above (or I am just not looking in the right place). 

I've cleared all caches but still no luck. Any help would be appreciated. 


Average of ratings: -
In reply to Andy van der Gugten

Re: Unable to log in after upgrade

by Ken Task -
Picture of Particularly helpful Moodlers

Below is for manual accounts ... your initial admin account when first installed.  Don't run MS Oauh so ??? there.

In the dB section of your config.php, what does it have for
dbcollation

What you see here must match the DB.
If you have CLI/shell access there are scripts that could help sort out
DB setup/config.

In order to use them to the fullest extent, you might have to change
DB user and DB password to the superuser for your MySQL/MariaDB server ... assuming
MySQL/MariaDB ... you did not say.

Scripts:
check_database_schema.php,mysql_collation.php,mysql_compressed_rows.php,mysql_engine.php

Run this one first:

php mysql_collation.php -l

That's a -lowercase "L".
At the bottom of output it should show all tables have the collation that matches
what's in config.php.  That script when run without a -l will show help and allow you to change the collation of DB, tables, and columns in tables ... IF using a user with privs.

'SoS', Ken

In reply to Ken Task

Re: Re: Unable to log in after upgrade

by Andy van der Gugten -
Hi Ken,

Thanks for the reply - that pointed me in the right direction.
I had converted the DB tables to utf8mb4_unicode_ci a while back but I must have copied the wrong config file at some stage because it was still set to utf8_general_ci.
Running php mysql_collation.php -l showed a mix of collations as I suspect updates would have changed tables back to utf8_general_ci.

ran:
/admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci
and in config.php set:
dbcollation' => 'utf8mb4_unicode_ci',
restarted mysql and now everything is back to normal agian.

Thanks again.
Average of ratings: Useful (1)
In reply to Andy van der Gugten

Re: Re: Re: Unable to log in after upgrade

by Ken Task -
Picture of Particularly helpful Moodlers

Glad to hear it!

'copied wrong config.php file ...' indicates you might want to check into using git for updates and upgrades.  No moving of files/folders ... they stay in place ... therefore less prone to human error. smile

https://docs.moodle.org/37/en/Git_for_Administrators

If you didn't install with git, please see how to 'side load' ...

https://sos.sosoftexas.org/blog/index.php/2018/09/02/using-git-with-moodle-side-load/

'SoS', Ken