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 8501917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:20:37+00:00 2026-06-11T01:20:37+00:00

From some application, I can’t connect to a remote database server: MYSQL conn; if(!mysql_init(&conn))

  • 0

From some application, I can’t connect to a remote database server:

  MYSQL conn;  

  if(!mysql_init(&conn))
      std::wcout << "Error: can't create MySQL-descriptor" << endl;   

  if(!mysql_real_connect(&conn,"ip","user","password","dbname",0,0,0))
       std::wcout << "Error: can't connect to MySQL server" << endl;     

  if(mysql_query(&conn, "SELECT VERSION()") != 0)
       std::wcout << "Error: can't execute SQL-query" << endl;

I opened port 3306 on the remote server:

 iptables -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT 
 iptables save
 iptables restart

Error:

Failed to connect to database:Error: Can’t connect to MySQL server on
‘ip_..’ (10060)

What could be the reason?

  • 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-11T01:20:39+00:00Added an answer on June 11, 2026 at 1:20 am

    You should display result of mysql_error after every failed test (following a successful mysql_init), e.g.:

     if(!mysql_real_connect(&conn,"ip","user","password","dbname",0,0,0))
         std::wcout << "Error: can't connect to MySQL server:"
                    << mysql_error (&conn) << endl; 
    

    otherwise your user won’t be able to understand what is happening to him.

    You’ll probably find out what is happening. If not, look into the documentation.

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

Sidebar

Related Questions

I want to upload a file to my server from some application. How can
In my application, I'm loading some data from a file. This can fail and
I need to call some PL/SQL procedures from my Java application. I can do
I develop some application that has database wery generic so really can't use it
I want to write an application that can prevent some application from launching. My
Extened question from In multi thread application how can i redirect stderr & stdout
I want to write an Android application that can display some data received(polled) from
I have a web application that loads some 50 tables from SQL Server into
Is there a way could i delete my application from some users iPhone by
I have read from some article that say's Apple doesn't approve the application which

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.