Well, I just found how to solve this.
As stated in the output I posted above, the problem it's basically Qt being unable to find libqsqlmysql.so, but thanks to ChatGPT and google searches I found a workaround:
Make sure that you have installed the MySQL client library on your system. You can check if it is installed by running the command locate libmysqlclient.so.21 (in case you are using Linux).
Make sure that the MySQL driver library is in a location where your Qt application can find it. You can try adding the directory where the MySQL driver library is located to the LD_LIBRARY_PATH environment variable, by running the command: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/mysql/lib
Then, run Qt from terminal. For example, I do it with this command: ~/Qt/Tools/QtCreator/bin/qtcreator
Thats it, now it should work.
If you don't want to execute the export LD_LIBRARY_PATH=... command everytime before opening Qt, you can set LD_LIBRARY_PATH under environment (Where you add environment variables) . Example:
[image: 0219fe83-192b-400b-acbe-db93587f7e35.png]
After your default values in LD_LIBRARY_PATH, add ::/path/to/mysql/lib. If you do this, It's not necessary to open Qt from terminal anymore.