当前位置:网站首页>The reasons why QT fails to connect to the database and common solutions
The reasons why QT fails to connect to the database and common solutions
2022-07-04 01:45:00 【CAccept】
use qDebug() << db.lastError().text(); Look at the cause of the error
① First, check your database name , user name , Host name , password , Are these port numbers set correctly
For example, if I write the user name wrong, the following error will appear
"Access denied for user 'rot'@'localhost' (using password: YES) QMYSQL: Unable to connect"
The database connection code is as follows
db.setDatabaseName("qtqq");// Database name ( Keep consistent with your settings )
db.setHostName("localhost");// Host name
db.setUserName("root");// user name
db.setPassword("sqhxxxx");// Password and us Mysql Your account and password are the same
db.setPort(3306);// Set the port number

② Look at your Navicat Is it open and connected ( I often forget )
③ If the problem is the lack of drivers, you have to add some files
The problem is displayed as :QMYSQL driver not loaded
resolvent :
mysql Of the installation file lib In the catalog libmysql.dll and libmysqld.dll Copied to the Qt5.5 Medium mingw Of bin Under the document .
If I know the reasons for other types of connection failures later, I will add , Now make do with it
边栏推荐
- C library function int fprintf (file *stream, const char *format,...) Send formatted output to stream
- Force buckle day32
- Pratique technique | analyse et solution des défaillances en ligne (Partie 1)
- Fundamentals of machine learning: feature selection with lasso
- Feign implements dynamic URL
- The contact data on Jerry's management device supports reading and updating operations [articles]
- Which insurance products can the elderly buy?
- Make drop-down menu
- Create template profile
- CLP information - how does the digital transformation of credit business change from star to finger?
猜你喜欢

Some other configurations on Huawei's spanning tree

MySQL introduction - functions (various function statistics, exercises, details, tables)

Install the pit that the electron has stepped on

Ka! Why does the seat belt suddenly fail to pull? After reading these pictures, I can't stop wearing them
![After listening to the system clear message notification, Jerry informed the device side to delete the message [article]](/img/0c/52816b75eb702c7c63966578ab4969.jpg)
After listening to the system clear message notification, Jerry informed the device side to delete the message [article]

Feign implements dynamic URL

Maximum likelihood method, likelihood function and log likelihood function

MySQL deadly serial question 2 -- are you familiar with MySQL index?

Lightweight Pyramid Networks for Image Deraining

Applet graduation project is based on wechat classroom laboratory reservation applet graduation project opening report function reference
随机推荐
mysql使用視圖報錯,EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
C import Xls data method summary I (upload files and create Workbooks)
MPLS③
【.NET+MQTT】. Net6 environment to achieve mqtt communication, as well as bilateral message subscription and publishing code demonstration of server and client
Remember a lazy query error
Winter vacation daily question -- a single element in an ordered array
Huawei rip and BFD linkage
All in one 1412: binary classification
[turn] solve the problem of "RSA public key not find" appearing in Navicat premium 15 registration
Force deduction solution summary 1189- maximum number of "balloons"
Day05 table
Msp32c3 board connection MSSQL method
Technical practice online fault analysis and solutions (Part 1)
Audio resource settings for U3D resource management
Applet graduation design is based on wechat course appointment registration. Applet graduation design opening report function reference
MySQL statement learning record
Jerry's modification setting status [chapter]
The force deduction method summarizes the single elements in the 540 ordered array
A malware detection method for checking PLC system using satisfiability modulus theoretical model
Gee: create a new feature and set corresponding attributes