DagdiHiman it looks like the database password or database name is invalid, or the database user doesn't have permission to access the database. So it must be an issue with the setup and not Flarum.
Maybe your database is setup in a kind of temporary manner ? Temporary password on the user ? Maybe that's an in-memory database instead of on-disk ?
What happens if you restart MySQL ? Does the error change ?
Did you have to delete and create the database again for it to work or just reinstalling Flarum but not the database/user worked again ?