Skip to content
QtWS25 Call for Papers
  • 0 Votes
    17 Posts
    1k Views
    JonBJ

    @MH24
    It vaguely, vaguely rings a bell that you have to do something special about root, possibly to do with how MySQL gets installed initially. Lots of hits for Googling mysql root localhost permission. I may have done the stuff mentioned in https://stackoverflow.com/a/46908573 in the past. (Be careful you don't lock yourself out, however!)

    But in any case what you have done now is better, as @Christian-Ehrlicher said you should not be using root user for your application.

  • 0 Votes
    2 Posts
    173 Views
    Christian EhrlicherC

    See https://bugreports.qt.io/browse/QTBUG-84797
    MYSQL_OPT_SSL_MODE is not yet added and when it will only be added for Qt6.6 and higher.

  • 0 Votes
    4 Posts
    1k Views
    Christian EhrlicherC

    Then please mark this topic as solved, thx.

  • QT6.3+mysql8.0+Mac

    Unsolved Qt 6
    3
    0 Votes
    3 Posts
    335 Views
    W

    @JonB thx. I input was wrong.

  • 0 Votes
    9 Posts
    474 Views
    Christian EhrlicherC

    It's or sure no problem of Qt or the QSqlTableModel - fix your access rights.

  • 0 Votes
    4 Posts
    251 Views
    VRoninV

    Yes, Qt.EditRole and Qt.DisplayRole are the same thing in non-customised Qt classes

  • 0 Votes
    4 Posts
    364 Views
    JonBJ

    @lanas
    Yes to all of that, by all means read that overview link. I didn't say that "will be hard to retrive data from data base if i did not work with qtsql classes". Using the Python SQL classes instead would be fine for retrieving data from the database. But when you want to display that data in your Qt UI, rows & columns from your SQL queries, that will require some coding to get the Python-SQL-fetched-data to the Qt UI widgets and back. Whereas if you use the Qt classes they fill Qt models directly, and those are what Qt QTableViews use to display (and even edit) data.

    In the simplest case, see if you can't use Qt's QSqlTableModel for attaching your data retrieval to the database. That will have the necessary SELECT/INSERT/UPDATE/DELETE automatically generated/issued for you for working on a SQL table in the database, without you having to write the SQL statements like you tried to in your question. And attaching a QTableView to the QSqlTableModel will display what you fetched without any code. And it can even allow you/the user to edit the data in the table and write ot back to the database for you.

  • 0 Votes
    5 Posts
    509 Views
    M

    @Christian-Ehrlicher said in building qsqlmysql.dll for msvc error:

    Forgot to copy or typo?

    I forgot to copy.
    I looked into Makefile.Release and realised that instead of

    C:\mysql\include

    this It was including this

    C:\Program Files\MySQL\MySQL Server 8.0\include

    I deleted qmake.stash and config.cache and repeated the qmake again and this time I generated qsqlmysql.dll successfully.
    Tested it with Sample Cpp code in Qt, it's working.
    @Christian-Ehrlicher Thanks for the suggestion.

  • 0 Votes
    3 Posts
    322 Views
    M

    Guys; May you please some help. I reached to a dead end

  • 0 Votes
    2 Posts
    780 Views
    Christian EhrlicherC

    @vin212 said in How use MYSQL on QT:

    MySql .................................. no

    ...

    I continue, i try this commande : nmake

    Why? As you can see qmake did not find your libs, so why do you think 'nmake' will do anything for mysql? As written in the documentation look into the logs and see why the libs were not found or usable.

  • 0 Votes
    6 Posts
    464 Views
    T

    ended up having to walk through dependency walker to solve as some necessary dll files were not where they needed to be.

  • 0 Votes
    33 Posts
    3k Views
    E

    @SGaist ok lemme try,if i understand what documentation say lol

  • 0 Votes
    4 Posts
    446 Views
    E

    @Christian-Ehrlicher yes,i just realize i forget to add sql to QT += core gui sql
    thanks for respone anyway

  • 0 Votes
    7 Posts
    766 Views
    J

    I did the migration with mysqldump then I edited the dump file. Then I have the resulting file into sqlite and saved it as database. The date columns are now stored in sqlite as TEXT fields. All done on a linux machine.

    Thank you VRonin for your suggestion. That sounds like a great idea. Can I do this in pyQt5 or do I need to go to C++? I think QSQLiteDriver is a plugin i.e. a shared library. That means I have to do this in C++. Is that right? I wanted to avoid C++ so that my application is more portable. But anyway this solution sounds great.

    Thanks for you answers guys.

  • 0 Votes
    6 Posts
    774 Views
    Pablo J. RoginaP

    @Giggon said in SQLite database creation:

    Thread to be closed

    Please go and mark the post as solved. Thanks

  • 0 Votes
    6 Posts
    563 Views
    SGaistS

    No it's not, you can see that with its constructors that take a QSqlDatabase parameter.

    No clear is not called, the destructor is.

    There's no need to create QSqlQuery objects on the heap.

  • 0 Votes
    8 Posts
    986 Views
    jsulmJ

    @projectbavaria Ging es nicht darum die gelesenen Daten in eine Datei reinzuschreiben? Wenn nicht, dann sollte auch nicht von einer Datei die Rede sein, da es sonst nur verwirrt.
    Also, was ist das: "haben wir versucht mit QFile aber es funktioniert nicht, Qt gibt meldung raus das es keine file gibt bzw. empty"?
    Wo wird in dem Code irgendwas mit QFile gemacht?

    Wie groß ist outByteArray und was ist drin?

  • 0 Votes
    4 Posts
    573 Views
    SGaistS

    No, you have to use the same compiler that was used to build Qt. You can't mix and match C++ librairies built with MinGW and MSVC.

  • 0 Votes
    3 Posts
    635 Views
    B

    @Bardfast said in Trouble building the QMYSQL Plugin on Unix (Mint 19.2):

    $QTDIR/$QTVERSION/gcc_64/bin/qmake -- MYSQL_PREFIX=/usr/include/mysql

    Thank you for your reply.

    Unfortunately the log doesn't tell me much. The log <./Src/qtbase/src/plugins/sqldrivers/config.log> reads as follows ...

    Command line: MYSQL_PREFIX=/usr/include/mysql Global lib dirs: [/home/qt/openssl-1.1.1b/lib] [/usr/lib/gcc/x86_64-linux-gnu/7 /usr/lib/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib] Global inc dirs: [/home/qt/openssl-1.1.1b/include] [/usr/include/c++/7 /usr/include/x86_64-linux-gnu/c++/7 /usr/include/c++/7/backward /usr/lib/gcc/x86_64-linux-gnu/7/include /usr/local/include /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed /usr/include/x86_64-linux-gnu /usr/include] loaded result for library config.sqldrivers.libraries.db2 test config.sqldrivers.libraries.db2 succeeded loaded result for library config.sqldrivers.libraries.ibase test config.sqldrivers.libraries.ibase succeeded loaded result for library config.sqldrivers.libraries.mysql test config.sqldrivers.libraries.mysql FAILED loaded result for library config.sqldrivers.libraries.oci test config.sqldrivers.libraries.oci succeeded loaded result for library config.sqldrivers.libraries.odbc test config.sqldrivers.libraries.odbc FAILED loaded result for library config.sqldrivers.libraries.psql test config.sqldrivers.libraries.psql FAILED loaded result for library config.sqldrivers.libraries.sqlite2 test config.sqldrivers.libraries.sqlite2 succeeded loaded result for library config.sqldrivers.libraries.tds test config.sqldrivers.libraries.tds FAILED

    Is this the 'test' log that you were referring to?