How to Build the QMYSQL Plugin on Unix and Mac OS X
You need the MySQL header files and as well as the shared library libmysqlclient.so. Depending on your Linux distribution you may need to install a package which is usually called "mysql-devel".
Tell qmake where to find the MySQL header files and shared libraries (here it is assumed that MySQL is installed in /usr/local) and run make:
cd $QTDIR/src/plugins/sqldrivers/mysql
qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro
make
After installing Qt, as described in the Installing Qt on X11 Platforms document, you also need to install the plugin in the standard location:
cd $QTDIR/src/plugins/sqldrivers/mysql
make install