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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:23:02+00:00 2026-05-30T10:23:02+00:00

Either this this question isn’t asked often (possible), everyone knows how to do it

  • 0

Either this this question isn’t asked often (possible), everyone knows how to do it (doubtful), or I don’t know how to search for it (likely).

I want to get my C++ program talking to my MySQL server and able to run commands on it. I know MySQL has connector code available, but 1) it seems like much more than I need and 2) I just cannot seem to get it to work anyway.

I want to be able to test the program on my computer, so remote access would be necessary. I do have SSH for the server.

My final deployment will be able to run on the server itself.

Executing and receiving/parsing output from MySQL databases is quite easy to do by hand. I can’t however, figure out which way to go to get my program to do this.

I figure I should be able to:
1. ssh into the web server (with password)
2. access the MySQL database
3. execute statements and retrieve their output

I’ve read a lot about fork() and popen(), but due to their read-only or write-only limitations (unless I misunderstand), I just don’t know where to go. Obviously I’d just take out the SSH step when the time comes to deploy it on the server. Can somebody give me some direction on this, or is this just not possible (doubtful).

It is our own dedicated server so we have full reign with ssh and WHM, but I’d rather minimize the “intrusion” since I don’t know enough about all the software on there if I broke something. I just want to communicate [directly] with the MySQL database.

Thanks so much! You guys are awesome!

  • 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-05-30T10:23:04+00:00Added an answer on May 30, 2026 at 10:23 am

    If you have SSH access, then you’re way overcomplicating this.

    Step 1: Set up an SSH tunnel:

    ssh -L 3306:localhost:3306 user@your.host.com
    

    Step 2: Use the local port like normal (i.e. just refer to localhost)

    mysql -u root -p < somescript.sql
    

    However since you’re using C++, you really should use a proper library (e.g. MySQL++). Educate yourself on SSH tunnels, they make life so much easier once you know about them.

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

Sidebar

Related Questions

Hi I know this question have been asked before but the answers there isn't
UPDATE 10/19/2010 I know I asked this question a while ago, but the workarounds
I know this question isn't directly programming related, but since I want to be
I know this question has been asked quite a few times, however, I have
I'm rephrasing this question because it was either too uninteresting or too incomprehensible. :)
Anyone know of a control for asp.net that can achieve this either server or
I can't find any information about this on either www.episerver.com or world.episerver.com, anyone knows?
First I will give a little background info so this question isn't completely without
I've read this question and the answers, but what isn't clear to me is
This question has been asked a lot and there are quite a few answers,

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.