QSqlDatabase:QMYSQLdrivernotloaded QSqlDatabase:availabledrivers:QSQLITE 解决方法,先看下是否已经安装了libqsqlmysql.so [test1@localhost~]$locatelibqsqlmysql.so /var/cache/abrt-di/usr/lib/debug/usr/lib/qt4/plugins/sqldrivers/libqsqlmysql.so.
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE
解决方法,先看下是否已经安装了libqsqlmysql.so
[test1@localhost ~]$ locate libqsqlmysql.so
/var/cache/abrt-di/usr/lib/debug/usr/lib/qt4/plugins/sqldrivers/libqsqlmysql.so.debug
我的系统上还没有安装,下面安装 qt-mysql.i686。
[root@localhost test1]# yum install qt-mysql.i686
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
qt-mysql i686 1:4.7.4-7.fc14 updates 67 k
[root@localhost test1]# updatedb
[test1@localhost ~]$ locate libqsqlmysql.so
/usr/lib/qt4/plugins/sqldrivers/libqsqlmysql.so
/var/cache/abrt-di/usr/lib/debug/usr/lib/qt4/plugins/sqldrivers/libqsqlmysql.so.debug
在程序里面调用
qDebug()QCoreApplication::libraryPaths ();
可以看到Qt 搜索库的路径。里面并没有/usr/lib/qt4/plugins/
这里有两种方式解决这个问题:
1、把libqsqlmysql.so所在的路径增加到库路径里面:
QcoreApplication::addLibraryPath("/usr/lib/qt4/plugins/");
2、直接复制libqsqlmysql.so到Qt的搜索路径中。
[test1@localhost ~]$ cp /usr/lib/qt4/plugins/sqldrivers/libqsqlmysql.so QtSDK/Desktop/Qt/4.8.1/gcc/plugins/sqldrivers/
http://doc.qt.nokia.com/4.7-snapshot/sql-driver.html

mySqlStringTypesimpactStorageAndPerformanCeaseAsfollows:1)長度,始終使用theSamestoragespace,whatcanbefasterbutlessspace-felfficity.2)varCharisvariable varcharisvariable length,morespace-morespace-morespace-effficitybuteftife buteftife butfority butfority textifforlyslower.3)

mysqlStringTypesIncludeVarChar,文本,char,Enum和set.1)varCharisVersAtileForvariable-lengthStringStringSuptoPuptOuptoPepePecifiedLimit.2)textisidealforlargetStortStorStoverStoverStorageWithoutAutAdefinedLength.3)charlisfixed-lenftenge,for forConsistentDatalikeCodes.4)

MySQLoffersvariousstringdatatypes:1)CHARforfixed-lengthstrings,2)VARCHARforvariable-lengthtext,3)BINARYandVARBINARYforbinarydata,4)BLOBandTEXTforlargedata,and5)ENUMandSETforcontrolledinput.Eachtypehasspecificusesandperformancecharacteristics,sochoose

TograntpermissionstonewMySQLusers,followthesesteps:1)AccessMySQLasauserwithsufficientprivileges,2)CreateanewuserwiththeCREATEUSERcommand,3)UsetheGRANTcommandtospecifypermissionslikeSELECT,INSERT,UPDATE,orALLPRIVILEGESonspecificdatabasesortables,and4)

toadduserInmysqleffect和securly,跟隨台詞:1)USEtheCreateUserStattoDaneWuser,指定thehostandastrongpassword.2)GrantNecterAryAryaryPrivilegesSustherthing privilegesgeStatement,usifementStatement,adheringtotheprinciplelastprefilegege.3)

toaddanewuserwithcomplexpermissionsinmysql,loldtheSesteps:1)創建eTheEserWithCreateuser'newuser'newuser'@''localhost'Indedify'pa ssword';。 2)GrantreadAccesstoalltablesin'mydatabase'withGrantSelectOnMyDatabase.to'newuser'@'localhost';。 3)GrantWriteAccessto'

MySQL中的字符串數據類型包括CHAR、VARCHAR、BINARY、VARBINARY、BLOB、TEXT,排序規則(Collations)決定了字符串的比較和排序方式。 1.CHAR適合固定長度字符串,VARCHAR適合可變長度字符串。 2.BINARY和VARBINARY用於二進制數據,BLOB和TEXT用於大對像數據。 3.排序規則如utf8mb4_unicode_ci忽略大小寫,適合用戶名;utf8mb4_bin區分大小寫,適合需要精確比較的字段。

最佳的MySQLVARCHAR列長度選擇應基於數據分析、考慮未來增長、評估性能影響及字符集需求。 1)分析數據以確定典型長度;2)預留未來擴展空間;3)注意大長度對性能的影響;4)考慮字符集對存儲的影響。通過這些步驟,可以優化數據庫的效率和擴展性。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SublimeText3 英文版
推薦:為Win版本,支援程式碼提示!

SAP NetWeaver Server Adapter for Eclipse
將Eclipse與SAP NetWeaver應用伺服器整合。

WebStorm Mac版
好用的JavaScript開發工具

MinGW - Minimalist GNU for Windows
這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。

SublimeText3 Linux新版
SublimeText3 Linux最新版