For anyone else with the same issue, here's how to fix it:
/etc/dovecot/dovecot.conf
....
userdb {
driver = prefetch
}
userdb {
driver = sql
args = /etc/dovecot/dovecot-mysql.conf
}
....
remove this:
userdb {
driver = prefetch
}
and restart postfix and dovecot.
Problem solved!