Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QT is not able to connect to MySQL.



  • Hello everyone, this is my first time in the forum. I'm trying work with a database in phpmyadmin but it seems I'm unable to do so. I'm a beginner and I know I ignore lots of things but I'm willing to learn.

    This is the code in mainwindow.cpp:

    #include "mainwindow.h"
    #include "ui_mainwindow.h"

    #include<QTimer>
    #include<QDateTime>
    #include<QDate>
    #include<QDebug>
    #include<QTime>

    #include<QSqlDatabase>
    #include<QtSql>
    #include<QSqlQuery>
    #include<QtNetwork>
    #include<QSqlError>

    QSqlDatabase baseDatos;

    void MainWindow::cronometro(){
    //Obtener tiempo real
    QDateTime fechaActual = QDateTime::currentDateTime();
    tiempoEpoch=fechaActual.toTime_t();
    //long int tiempoUnix =fechaActual.toTime_t();
    //qDebug() << "Time: " <<tiempoUnix;
    ui->label_8->setText(fechaActual.toString());
    QTime tiempoActual = QTime::currentTime();
    //qDebug() << "Tiempo actual: " << tiempoActual;
    int horas = tiempoActual.hour();
    int minutos = tiempoActual.minute();
    int segundos = tiempoActual.second();
    ui->lcdNumber->display(horas);
    ui->lcdNumber_2->display(minutos);
    ui->lcdNumber_3->display(segundos);
    }

    MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    QTimer *temporizador = new QTimer(this);
    connect(temporizador, SIGNAL(timeout()), this, SLOT(cronometro()));
    temporizador->start(1000);
    baseDatos = QSqlDatabase::addDatabase("QMYSQL");
    baseDatos.setHostName("localhost");
    baseDatos.setPort(3306);
    baseDatos.setDatabaseName("tarea");
    baseDatos.setUserName("admin51");
    baseDatos.setPassword("hola1234");

    if(baseDatos.open()){
        qDebug() << "Data base is open";
    }
    else{
        qDebug() << "Data base is NOT open";
    }
    

    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    void MainWindow::on_pushButton_clicked()
    {
    codigo = ui->lineEdit->text();
    evento = "Ent";

    if(baseDatos.open()){
        //Insertar 4 columnas
        QString comandoMYSQL = "INSERT INTO ejemplo3_checador_tiempo(fecha,codigo,evento,imagen) VALUES(?,?,?,?)";
        QSqlQuery comando;
        comando.prepare(comandoMYSQL);
        comando.addBindValue(codigo);
        comando.addBindValue(evento);
        QVariant valorlong = QVariant::fromValue(tiempoEpoch);
        //qDebug() << "Tiempo: " << valorLong;
        comando.addBindValue(valorlong);
        comando.addBindValue(imagen);
        if(comando.exec()){
         qDebug() << "El dato se inserto correctamente";
        }
        else{
        qDebug() << "Error";
       }
    }
    

    }

    void MainWindow::on_pushButton_2_clicked()
    {
    codigo = ui->lineEdit->text();
    evento = "Sal";

    if(baseDatos.open()){
        //Insertar 4 columnas
        QString comandoMYSQL = "INSERT INTO ejemplo3_checador_tiempo(fecha,codigo,evento,imagen) VALUES(?,?,?,?)";
        QSqlQuery comando;
        comando.prepare(comandoMYSQL);
        comando.addBindValue(codigo);
        comando.addBindValue(evento);
        QVariant valorlong = QVariant::fromValue(tiempoEpoch);
        //qDebug() << "Tiempo: " << valorLong;
        comando.addBindValue(valorlong);
        comando.addBindValue(imagen);
        if(comando.exec()){
             qDebug() << "El dato se inserto correctamente";
        }
        else{
             qDebug() << "Error";
        }
    }
    

    }

    I will appreciate your support.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Which version of Qt are you using ?
    On which OS ?
    Which version of MySQL ?
    How did you install Qt ?



  • @SGaist
    My QT version is 5.12.8, I'm using Ubuntu20.04. MySQL is Ver 8.0.23. QT installed by downloading the file form its official web.


  • Lifetime Qt Champion

    @Jesus-Ocegueda said in QT is not able to connect to MySQL.:

    but it seems I'm unable to do so

    What exactly happens?

    Set QT_DEBUG_PLUGINS environment variable before starting your app and post its output (https://doc.qt.io/qt-5/debug.html).



  • @Jesus-Ocegueda said in QT is not able to connect to MySQL.:

    if(baseDatos.open()){
        qDebug() << "Data base is open";
    }
    else{
        qDebug() << "Data base is NOT open";
    }
    

    I would suggest you to change this to:

    if(baseDatos.open()){
        qDebug() << "Data base is open";
    }
    else{
        qDebug() << "Data base is NOT open:" << baseDatos.lastError().text();
    }
    

    How did you install Qt-Kit on your PC, with MaintenanceTool or with the packet manager of your Linux distribution?
    AFAIK, starting with Qt 5.12.x, the MySQL plugin is only distributed with MaintenanceTool as sources and must be build by yourself, because of Oracle/MySQL licencing changes.

    => https://doc.qt.io/qt-5.12/sql-driver.html#how-to-build-the-qmysql-plugin-on-unix-and-macos


  • Lifetime Qt Champion

    Since you are using a pretty recent Linux distribution, you might want to consider using the Qt version provided by it rather than building the plugin yourself (not that it is something hard though).



  • This post is deleted!


  • This post is deleted!


  • @KroMignon said in QT is not able to connect to MySQL.:

    @Jesus-Ocegueda said in QT is not able to connect to MySQL.:

    if(baseDatos.open()){
        qDebug() << "Data base is open";
    }
    else{
        qDebug() << "Data base is NOT open";
    }
    

    I would suggest you to change this to:

    if(baseDatos.open()){
        qDebug() << "Data base is open";
    }
    else{
        qDebug() << "Data base is NOT open:" << baseDatos.lastError().text();
    }
    

    How did you install Qt-Kit on your PC, with MaintenanceTool or with the packet manager of your Linux distribution?
    AFAIK, starting with Qt 5.12.x, the MySQL plugin is only distributed with MaintenanceTool as sources and must be build by yourself, because of Oracle/MySQL licencing changes.

    => https://doc.qt.io/qt-5.12/sql-driver.html#how-to-build-the-qmysql-plugin-on-unix-and-macos

    This is what I got: "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) QMYSQL: Unable to connect"


  • Lifetime Qt Champion

    @Jesus-Ocegueda said in QT is not able to connect to MySQL.:

    "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) QMYSQL: Unable to connect"

    So you should make sure your MySQL server is running (on the given port).



  • @Jesus-Ocegueda said in QT is not able to connect to MySQL.:

    This is what I got: "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) QMYSQL: Unable to connect"

    It looks like that the MySQL plugin is there.
    Are you sure that you setup the right connection options?
    You could test it with the console client:

    mysql --host=localhost --port=3306 --user=admin51 --password=hola1234 tarea
    

    cf. https://dev.mysql.com/doc/refman/8.0/en/connecting.html



  • @SGaist said in QT is not able to connect to MySQL.:

    Since you are using a pretty recent Linux distribution, you might want to consider using the Qt version provided by it rather than building the plugin yourself (not that it is something hard though).

    You recommend uninstall QT and install it from the terminal?
    LIke this: https://www.osradar.com/install-qtcreator-on-ubuntu-20-04-18-04/



  • @KroMignon said in QT is not able to connect to MySQL.:

    mysql --host=localhost --port=3306 --user=admin51 --password=hola1234 tarea

    This is the output I got after running the command line your gave me:

    jesus@jesus-Inspiron-5559:~$ mysql --host=localhost --port=3306 --user=admin51 --password=hola1234 tarea
    mysql: [Warning] Using a password on the command line interface can be insecure.
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A

    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 8
    Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)

    Copyright (c) 2000, 2021, Oracle and/or its affiliates.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    mysql>



  • @jsulm said in QT is not able to connect to MySQL.:

    @Jesus-Ocegueda said in QT is not able to connect to MySQL.:

    but it seems I'm unable to do so

    What exactly happens?

    Set QT_DEBUG_PLUGINS environment variable before starting your app and post its output (https://doc.qt.io/qt-5/debug.html).

    How do I set that? Would you mind give me an example?

    I'm guessing that I only need to place it right after my libraries on my mainwindow.cpp file. Is that correct?
    LIke: QT_DEBUG_PLUGINS;

    I'm not sure because this is my first time with C++



  • @Jesus-Ocegueda
    I'm guessing you run your program from within Qt Creator? In which case you need to set it as a runtime environment variable for when your program is executed.

    If you know how to run your executable from a terminal you need to type export QT_DEBUG_PLUGINS=1 there.


  • Lifetime Qt Champion

    Since the mysql plugin is properly loaded there is no problem with Qt at all. Please read e.g. here: https://www.dailyrazor.com/blog/cant-connect-to-local-mysql-server-through-socket/ - the first idea would be to use 127.0.0.1 as suggested there so no local socket but tcp/ip is used.



  • @Christian-Ehrlicher said in QT is not able to connect to MySQL.:

    Since the mysql plugin is properly loaded there is no problem with Qt at all. Please read e.g. here: https://www.dailyrazor.com/blog/cant-connect-to-local-mysql-server-through-socket/ - the first idea would be to use 127.0.0.1 as suggested there so no local socket but tcp/ip is used.

    I follow the article and doing the first instruction I got this:

    jesus@jesus-Inspiron-5559:~$ mysqladmin -u root -p status
    Enter password:
    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost''

    After I try the option u provided I got this in QT:

    Data base is NOT open "SSL connection error: unknown error number QMYSQL: Unable to connect"

    I found intriguing that 'root'@'localhost'' it has another ' after host. Should I consider that too?

    I also run sudo mysql and here are the users I have:

    jesus@jesus-Inspiron-5559:~$ sudo mysql
    [sudo] password for jesus:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 13
    Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)

    Copyright (c) 2000, 2021, Oracle and/or its affiliates.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    mysql> SELECT user, authentication_string,plugin,host FROM msql.user;
    ERROR 1049 (42000): Unknown database 'msql'
    mysql> SELECT user, authentication_string,plugin,host FROM mysql.user;
    +------------------+------------------------------------------------------------------------+-----------------------+-----------+
    | user | authentication_string | plugin | host |
    +------------------+------------------------------------------------------------------------+-----------------------+-----------+
    | admin51 | $A$005$9T
    T^&)o@TW^Q-h_&oT.MY9ehrMXFyNzv8k33JesTDZXuHjqUMWeSdvI14f22 | caching_sha2_password | % |
    | debian-sys-maint | $A$005$(t[Bxr/[VJ_%KIDDL2c8KVbWsqR4cm7eSWTfZtbj1Y7HHnMl3IrkUhJr5 | caching_sha2_password | localhost |
    | mysql.infoschema | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | localhost |
    | mysql.session | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | localhost |
    | mysql.sys | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | localhost |
    | phpmyadmin | $A$005$:;]J;=H]l9 }E|QYK8HLtTg7fPJ7r3DC.syBTVait3ZiLHSfUaGEKiKkF0 | caching_sha2_password | localhost |
    | root | | auth_socket | localhost |
    +------------------+------------------------------------------------------------------------+-----------------------+-----------+
    7 rows in set (0.01 sec)

    mysql>



  • @JonB said in QT is not able to connect to MySQL.:

    @Jesus-Ocegueda
    I'm guessing you run your program from within Qt Creator? In which case you need to set it as a runtime environment variable for when your program is executed.

    If you know how to run your executable from a terminal you need to type export QT_DEBUG_PLUGINS=1 there.

    How do I run it from terminal?
    Should I just open a terminal on the folder my .pro file is?


  • Lifetime Qt Champion

    Just do the export, it will be valid for the terminal session until you unset it or close the terminal.

    Then go to the folder where your application is and execute it.



  • @SGaist said in QT is not able to connect to MySQL.:

    Just do the export, it will be valid for the terminal session until you unset it or close the terminal.

    Then go to the folder where your application is and execute it.

    I bet this is easy but I don't get how to proceed when you say export, will you mind explain that or how to look it up that on google to search how to do that


  • Lifetime Qt Champion

    @JonB already wrote what to do:
    @JonB said in QT is not able to connect to MySQL.:

    type export QT_DEBUG_PLUGINS=1



  • @SGaist said in QT is not able to connect to MySQL.:

    @JonB already wrote what to do:
    @JonB said in QT is not able to connect to MySQL.:

    type export QT_DEBUG_PLUGINS=1

    The thing is that I don't know how to run it from the terminal, I do not understand the process, and I know this forum is not for C++, my bad :(


  • Lifetime Qt Champion

    This has nothing to do with C++ in this case, it's the Linux export command.

    The instruction is literally: Type export QT_DEBUG_PLUGINS=1 into your terminal. There's nothing more to it.



  • @SGaist said in QT is not able to connect to MySQL.:

    This has nothing to do with C++ in this case, it's the Linux export command.

    The instruction is literally: Type export QT_DEBUG_PLUGINS=1 into your terminal. There's nothing more to it.

    Alrighty!
    As soon as I open the terminal I type that’s but it shows no output. Should I open the terminal on the folder where my project is?


  • Lifetime Qt Champion

    @Jesus-Ocegueda said in QT is not able to connect to MySQL.:

    As soon as I open the terminal I type that’s but it shows no output

    After typing this command you need to start the app (in same terminal):

    export QT_DEBUG_PLUGINS=1
    ./my_app_exe
    

    If you want to start from QtCreator then set QT_DEBUG_PLUGINS in Projects/Build & Run/Run/Run Environment".



  • @jsulm said in QT is not able to connect to MySQL.:

    @Jesus-Ocegueda said in QT is not able to connect to MySQL.:

    As soon as I open the terminal I type that’s but it shows no output

    After typing this command you need to start the app (in same terminal):

    export QT_DEBUG_PLUGINS=1
    ./my_app_exe
    

    If you want to start from QtCreator then set QT_DEBUG_PLUGINS in Projects/Build & Run/Run/Run Environment".

    So instead of ./my_app_exe it will be ./qt?


  • Lifetime Qt Champion

    @Jesus-Ocegueda said in QT is not able to connect to MySQL.:

    So instead of ./my_app_exe it will be ./qt?

    Instead of my_app_exe you use the name of your executable



  • @jsulm said in QT is not able to connect to MySQL.:

    @Jesus-Ocegueda said in QT is not able to connect to MySQL.:

    So instead of ./my_app_exe it will be ./qt?

    Instead of my_app_exe you use the name of your executable

    You mean my .pro file?



  • @Jesus-Ocegueda

    You mean my .pro file?

    No, the executable program which you build and run all the time.



  • @JonB said in QT is not able to connect to MySQL.:

    @Jesus-Ocegueda

    You mean my .pro file?

    No, the executable program which you build and run all the time.
    Alrighty, that will be the mainwindow.cpp



  • @Jesus-Ocegueda said in QT is not able to connect to MySQL.:

    Alrighty, that will be the mainwindow.cpp

    I'm afraid not, that is a source code file! No use at all here....

    Have you ever written source code for a compiled language like C++ before? To be fair, since you reference phpmyadmin, you may not have done. But then there is a big comprehension leap.

    Do you understand what is going on when you type some code into a C++ file in Qt Creator and press one the Build (or Run or Debug) buttons? You don't need to know all the details, but I do think you should read up on what "compilation" is all about, because it will help with other things.



  • @JonB said in QT is not able to connect to MySQL.:

    @Jesus-Ocegueda said in QT is not able to connect to MySQL.:

    Alrighty, that will be the mainwindow.cpp

    I'm afraid not, that is a source code file! No use at all here....

    Have you ever written source code for a compiled language like C++ before? To be fair, since you reference phpmyadmin, you may not have done. But then there is a big comprehension leap.

    Do you understand what is going on when you type some code into a C++ file in Qt Creator and press one the Build (or Run or Debug) buttons? You don't need to know all the details, but I do think you should read up on what "compilation" is all about, because it will help with other things.

    I understand, thank you for the recommendation, @JonB



  • @Jesus-Ocegueda
    Look, forget about directly running the executable for now!

    From Qt Creator:

    1. Click Projects down the left-hand "toolbar".
    2. In the window which comes up, at the left, in the Build & Run section, under Desktop, click on the word Run.
    3. In the Run Settings filling the main area, find Run Environment.
    4. It presently says: Use Build Environment.
    5. Click the Details button to the right of that.
    6. You are presented with a window with a list of all the environment variables your program will execute with.
    7. Click the Add button.
    8. Add an environment variable whose name is QT_DEBUG_PLUGINS, and give it a value of 1.
    9. Now run your program from within Creator.
    10. Look in the Application Output window, at the bottom. You should see lots of diagnostic information.

    This is what people were asking you to do. Whether it will contain useful information for whatever your issue is I do not know.



  • @JonB said in QT is not able to connect to MySQL.:

    QT_DEBUG_PLUGINS

    OMG!
    Thank you for your patience, I definitely treasure this. I'm gonna start reading it. However I will share it in case someone can identify something:

    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqeglfs.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqeglfs.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "eglfs"
    ]
    },
    "archreq": 0,
    "className": "QEglFSIntegrationPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("eglfs")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqeglfs.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqlinuxfb.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqlinuxfb.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "linuxfb"
    ]
    },
    "archreq": 0,
    "className": "QLinuxFbIntegrationPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("linuxfb")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqlinuxfb.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqminimal.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqminimal.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "minimal"
    ]
    },
    "archreq": 0,
    "className": "QMinimalIntegrationPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqminimal.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqminimalegl.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqminimalegl.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "minimalegl"
    ]
    },
    "archreq": 0,
    "className": "QMinimalEglIntegrationPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("minimalegl")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqminimalegl.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqoffscreen.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqoffscreen.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "offscreen"
    ]
    },
    "archreq": 0,
    "className": "QOffscreenIntegrationPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("offscreen")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqoffscreen.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqvnc.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqvnc.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "vnc"
    ]
    },
    "archreq": 0,
    "className": "QVncIntegrationPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("vnc")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqvnc.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqwayland-egl.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqwayland-egl.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "wayland-egl"
    ]
    },
    "archreq": 0,
    "className": "QWaylandEglPlatformIntegrationPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("wayland-egl")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqwayland-egl.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqwayland-generic.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqwayland-generic.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "wayland"
    ]
    },
    "archreq": 0,
    "className": "QWaylandIntegrationPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("wayland")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqwayland-generic.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqwayland-xcomposite-egl.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqwayland-xcomposite-egl.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "wayland-xcomposite-egl"
    ]
    },
    "archreq": 0,
    "className": "QWaylandXCompositeEglPlatformIntegrationPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("wayland-xcomposite-egl")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqwayland-xcomposite-egl.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqwayland-xcomposite-glx.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqwayland-xcomposite-glx.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "wayland-xcomposite-glx"
    ]
    },
    "archreq": 0,
    "className": "QWaylandXCompositeGlxPlatformIntegrationPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("wayland-xcomposite-glx")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqwayland-xcomposite-glx.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqwebgl.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqwebgl.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "webgl"
    ]
    },
    "archreq": 0,
    "className": "QWebGLIntegrationPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("webgl")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqwebgl.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqxcb.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqxcb.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "xcb"
    ]
    },
    "archreq": 0,
    "className": "QXcbIntegrationPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("xcb")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqxcb.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Interfaces-2021A/Ejemplo-3-Checador-de-Horarios/build-Ejemplo-3-Checador-de-Horarios-Desktop_Qt_5_12_8_GCC_64bit-Debug/platforms" ...
    loaded library "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqxcb.so"
    loaded library "Xcursor"
    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Qt/5.12.8/gcc_64/plugins/platformthemes" ...
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platformthemes/libqgtk3.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platformthemes/libqgtk3.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
    "MetaData": {
    "Keys": [
    "gtk3"
    ]
    },
    "archreq": 0,
    "className": "QGtk3ThemePlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("gtk3")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platformthemes/libqgtk3.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platformthemes/libqxdgdesktopportal.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platformthemes/libqxdgdesktopportal.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
    "MetaData": {
    "Keys": [
    "xdgdesktopportal",
    "flatpak",
    "snap"
    ]
    },
    "archreq": 0,
    "className": "QXdgDesktopPortalThemePlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("xdgdesktopportal", "flatpak", "snap")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platformthemes/libqxdgdesktopportal.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Interfaces-2021A/Ejemplo-3-Checador-de-Horarios/build-Ejemplo-3-Checador-de-Horarios-Desktop_Qt_5_12_8_GCC_64bit-Debug/platformthemes" ...
    loaded library "/home/jesus/Qt/5.12.8/gcc_64/plugins/platformthemes/libqgtk3.so"
    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforminputcontexts" ...
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
    "MetaData": {
    "Keys": [
    "compose",
    "xim"
    ]
    },
    "archreq": 0,
    "className": "QComposePlatformInputContextPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("compose", "xim")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
    "MetaData": {
    "Keys": [
    "ibus"
    ]
    },
    "archreq": 0,
    "className": "QIbusPlatformInputContextPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("ibus")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
    "MetaData": {
    "Keys": [
    "qtvirtualkeyboard"
    ]
    },
    "archreq": 0,
    "className": "QVirtualKeyboardPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("qtvirtualkeyboard")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Interfaces-2021A/Ejemplo-3-Checador-de-Horarios/build-Ejemplo-3-Checador-de-Horarios-Desktop_Qt_5_12_8_GCC_64bit-Debug/platforminputcontexts" ...
    loaded library "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so"
    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Qt/5.12.8/gcc_64/plugins/styles" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Interfaces-2021A/Ejemplo-3-Checador-de-Horarios/build-Ejemplo-3-Checador-de-Horarios-Desktop_Qt_5_12_8_GCC_64bit-Debug/styles" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Qt/5.12.8/gcc_64/plugins/sqldrivers" ...
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/sqldrivers/libqsqlite.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/sqldrivers/libqsqlite.so, metadata=
    {
    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
    "MetaData": {
    "Keys": [
    "QSQLITE"
    ]
    },
    "archreq": 0,
    "className": "QSQLiteDriverPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("QSQLITE")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/sqldrivers/libqsqlite.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/sqldrivers/libqsqlmysql.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/sqldrivers/libqsqlmysql.so, metadata=
    {
    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
    "MetaData": {
    "Keys": [
    "QMYSQL3",
    "QMYSQL"
    ]
    },
    "archreq": 0,
    "className": "QMYSQLDriverPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/sqldrivers/libqsqlmysql.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/sqldrivers/libqsqlodbc.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/sqldrivers/libqsqlodbc.so, metadata=
    {
    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
    "MetaData": {
    "Keys": [
    "QODBC3",
    "QODBC"
    ]
    },
    "archreq": 0,
    "className": "QODBCDriverPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("QODBC3", "QODBC")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/sqldrivers/libqsqlodbc.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/sqldrivers/libqsqlpsql.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/sqldrivers/libqsqlpsql.so, metadata=
    {
    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
    "MetaData": {
    "Keys": [
    "QPSQL7",
    "QPSQL"
    ]
    },
    "archreq": 0,
    "className": "QPSQLDriverPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("QPSQL7", "QPSQL")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/sqldrivers/libqsqlpsql.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Interfaces-2021A/Ejemplo-3-Checador-de-Horarios/build-Ejemplo-3-Checador-de-Horarios-Desktop_Qt_5_12_8_GCC_64bit-Debug/sqldrivers" ...
    loaded library "/home/jesus/Qt/5.12.8/gcc_64/plugins/sqldrivers/libqsqlmysql.so"
    Data base is NOT open "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) QMYSQL: Unable to connect"
    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Qt/5.12.8/gcc_64/plugins/xcbglintegrations" ...
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/xcbglintegrations/libqxcb-egl-integration.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/xcbglintegrations/libqxcb-egl-integration.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.Xcb.QXcbGlIntegrationFactoryInterface.5.5",
    "MetaData": {
    "Keys": [
    "xcb_egl"
    ]
    },
    "archreq": 0,
    "className": "QXcbEglIntegrationPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("xcb_egl")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/xcbglintegrations/libqxcb-egl-integration.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/xcbglintegrations/libqxcb-glx-integration.so"
    Found metadata in lib /home/jesus/Qt/5.12.8/gcc_64/plugins/xcbglintegrations/libqxcb-glx-integration.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.Xcb.QXcbGlIntegrationFactoryInterface.5.5",
    "MetaData": {
    "Keys": [
    "xcb_glx"
    ]
    },
    "archreq": 0,
    "className": "QXcbGlxIntegrationPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("xcb_glx")
    QFactoryLoader::QFactoryLoader() looking at "/home/jesus/Qt/5.12.8/gcc_64/plugins/xcbglintegrations/libqxcb-glx-integration.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Interfaces-2021A/Ejemplo-3-Checador-de-Horarios/build-Ejemplo-3-Checador-de-Horarios-Desktop_Qt_5_12_8_GCC_64bit-Debug/xcbglintegrations" ...
    loaded library "/home/jesus/Qt/5.12.8/gcc_64/plugins/xcbglintegrations/libqxcb-glx-integration.so"
    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Qt/5.12.8/gcc_64/plugins/accessible" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Interfaces-2021A/Ejemplo-3-Checador-de-Horarios/build-Ejemplo-3-Checador-de-Horarios-Desktop_Qt_5_12_8_GCC_64bit-Debug/accessible" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Qt/5.12.8/gcc_64/plugins/accessiblebridge" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/home/jesus/Interfaces-2021A/Ejemplo-3-Checador-de-Horarios/build-Ejemplo-3-Checador-de-Horarios-Desktop_Qt_5_12_8_GCC_64bit-Debug/accessiblebridge" ...
    QLibraryPrivate::unload succeeded on "/home/jesus/Qt/5.12.8/gcc_64/plugins/xcbglintegrations/libqxcb-glx-integration.so"
    QLibraryPrivate::unload succeeded on "/home/jesus/Qt/5.12.8/gcc_64/plugins/sqldrivers/libqsqlmysql.so"
    QLibraryPrivate::unload succeeded on "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so"
    QLibraryPrivate::unload succeeded on "/home/jesus/Qt/5.12.8/gcc_64/plugins/platformthemes/libqgtk3.so"
    QLibraryPrivate::unload succeeded on "/home/jesus/Qt/5.12.8/gcc_64/plugins/platforms/libqxcb.so"
    QLibraryPrivate::unload succeeded on "Xcursor" (faked)


  • Lifetime Qt Champion

    Again: this is not a Qt sql plugin problem - as you can see the connection is refused to the attempt to connect through a local socket instead tcp/ip which seems to be forbidden. All explained in my link I gave and I'm pretty sure google can tell much more about this if it's not properly enough explained there.



  • @Christian-Ehrlicher said in QT is not able to connect to MySQL.:

    Again: this is not a Qt sql plugin problem - as you can see the connection is refused to the attempt to connect through a local socket instead tcp/ip which seems to be forbidden. All explained in my link I gave and I'm pretty sure google can tell much more about this if it's not properly enough explained there.

    You right I’ve not read the entire article. Thank you and I will let you know the result.


Log in to reply