Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8094869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:56:02+00:00 2026-06-05T20:56:02+00:00

I have a local Database running on localhost:3306, which I access with MySQL Workbench.

  • 0

I have a local Database running on localhost:3306, which I access with MySQL Workbench. This works fine, I can create alter, do whatever I want to table. I have two Schemas, “test” and “test2”.

I want to connect to it via Qt. here is my code:

QSqlDatabase m_db = QSqlDatabase::addDatabase("QPSQL"); 
m_db.setHostName("localhost");
m_db.setDatabaseName("test");
m_db.setPort(3306);
m_db.setUserName("root");
m_db.setPassword("MyAwesomePasswordThatIsUnHackableAndNotMyBirthdayAtAll...");
bool ok = m_db.open();

I followed the example found here QSqlDataBase Class reference

and m_db.open() always returns false. I’m not too sure what I have to pass to addDataBase() or setDataBaseName. Thanks for the help!

Edit: If I use addDatabase(“QMYSQL”) the error is “Driver not loaded”
I’m on windows 7, using Qt 4.8.1.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:56:03+00:00Added an answer on June 5, 2026 at 8:56 pm

    There is no MySQL precompiled plugin installed. You have to compile it yourself. Or you may also use ODBC gateway to your MySQL database, since QODBC plugin is installed or can be easily compiled (without a need of MySQL development libraries).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an android application in which i have a local database.I want
I would like to develop an Android application which will have a local database.
I have shared hosting on CentOS with local MySQL database. I'm able to run
I have a saved SQLCompare project which I use to synchronize my local database
I'm running Linux Mint and trying to connect to mySQL this way mysql --port=3306
I have a application, running with MySQL in my local machine. There is a
So I have a MySQL database, and I have a datasource on a local
I have built a local DVD Database using Codeigniter, With film names etc in.
I have searched inoformation to how attach local database to the IPA file to
I have connected to local and server database from local SqlServer 2005. How to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.