I wonder whether we have exactly the same problem, but if not the same, it looks quite related.
We've just upgraded a site from 1.6.3 (long story why we were still using that version) to 1.8.11.
Users lost the ability to login and also lost their enrollment to courses.
We fix the enrollment to courses by adding them again course by course with the new roles, etc.
But even after that, students can't log in.
I've created a brand new user, and I've noticed that I can log in with no problems. So then I compared that new user with former students (directly at the mdl_user table; phpmyadmin has been very helpfull! ), and I noticed that the mnethostid field was "0" for former students which suffered the upgrade process, and "1" for the brand new user with no problem to log in.
So, I changed that field to 1 to 1 former student, and it worked! So that I applied the change to all users (2000+).
I wonder if this is a good workaround or if we will face other problems in other tables due to this unresolved issue with mnethostid...
And hint would be welcome...
xp1829 at iesbarcelona.org