I found a solution although this is not the straightforward way to compile all at once.
First I compiled and installed Qt 5.12.4 without the MySQL driver plugin as described in the tutorial referenced in my original question.
I'm not sure if this next step is really required, but then I created symbolic links to redirect from MySQL to MariaDB in order to assure that the qmake will find the expected MySQL libraries:
sudo ln -s /usr/lib/arm-linux-gnueabihf/libmariadbclient.a /usr/lib/arm-linux-gnueabihf/libmysqlclient.a
sudo ln -s /usr/lib/arm-linux-gnueabihf/libmysqlclient_r.a /usr/lib/arm-linux-gnueabihf/libmysqlclient_r.a
sudo ln -s /usr/lib/arm-linux-gnueabihf/libmysqlclient_r.so /usr/lib/arm-linux-gnueabihf/libmysqlclient_r.so
sudo ln -s /usr/lib/arm-linux-gnueabihf/libmysqlclient.so /usr/lib/arm-linux-gnueabihf/libmysqlclient.so
Thereafter I followed the official Qt documentation on "How to Build the QMYSQL Plugin on Unix and macOS" (https://doc.qt.io/qt-5/sql-driver.html):
Thus I changed into the the source directory:
cd qt-everywhere-src-5.12.4/qtbase/src/plugins/sqldrivers/
I executed the previously installed qmake and provided the path to my symbolic links
/opt/Qt5.12/bin/qmake -- MYSQL_PREFIX=/usr/lib/arm-linux-gnueabihf
which yields
Running configuration tests...
Checking for DB2 (IBM)... no
Checking for InterBase... no
Checking for MySQL... yes
Checking for OCI (Oracle)... no
Checking for ODBC... no
Checking for PostgreSQL... yes
Checking for SQLite (version 2)... no
Checking for TDS (Sybase)... no
Done running configuration tests.
Configure summary:
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. yes
OCI (Oracle) ........................... no
ODBC ................................... no
PostgreSQL ............................. yes
SQLite2 ................................ no
SQLite ................................. yes
Using system provided SQLite ......... no
TDS (Sybase) ........................... no
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into '/opt/Qt5.12'.
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
Then I build the MySQL driver plugin
make sub-mysql
which was found in
qt-everywhere-src-5.12.4/qtbase/src/plugins/sqldrivers/mysql
Finally, I simply copied the built library into the related location of my Qt 5.12 installation:
sudo cp plugins/sqldrivers/libqsqlmysql.so /opt/Qt5.12/plugins/sqldrivers/
This approach is maybe not the perfect solution, but at least it worked for me.