If you didn´t compile dovecot from source, you need to install the dovecot-mysql package:
RedHat/CentOS/Fedora:
yum install dovecot-mysql
Debian:
apt-get install dovecot-mysql
If you compiled dovecot from source, you need to add mysql to your compile options.