Hi and welcome to devnet,
Understand the licensing constraints of using a static build of Qt and be ready to abide by them
Install an up to date version of OpenSSL (the system version is just too old)
Install MariaDB
Download Qt's source
Read documentation about static building
Pass the -openssl-linked as parameter to configure
Pass -sql-mysql as parameter to configure
Pass the -I and -L parameters as needed in order for Qt to find the MariaDB and OpenSSL libraries.
Call make -jX where X is the number of cores of your machine multiplied by 2 plus 1.
Go grab <insert favorite beverage> and look at your processors heating up
Call make install
Enjoy development