0

I need to write a C program that connects to a MySQL server and executes an SQL query from a text file having a single query, in linux platform.

I am doing C programming for a while and also have elementary understanding in SQL.

Now my queries:

For this what are the packages i need to install in my linux system?

How can i do this(programming wise)?

Please give me a starting point where i could begin. Sample codes, links of sites covering this topic and other study materials will very helpful.

Thanks in advance

2 Answers 2

3

You must install a C compiler and the libmysql development files for your distro. After that you use the MySQL C API in your code, and link with the appropriate libraries when building.

Sign up to request clarification or add additional context in comments.

Comments

0

I need to write a C program that connects to a MySQL server and executes an SQL query from a text file having a single query, in linux platform.

If this is really all your program needs to do, and nothing else, it is already written ... you can use the mysql client:

mysql < my_file.sql

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.