char stmt_buf[1024], buf[(1024*2)+1];
stmt_buf ="SELECT id, title FROM post LIMIT 5;";

I get an error:

connect2.c: In function ‘main’:
connect2.c:217: error: incompatible types in assignment

Use strcpy() to copy the string.

A more detailed answer is that C doesn't really have a string type. Because there's no string type, we use arrays of char with a special character acting as the end of the string, and all of the rules for arrays apply. In other words, arrays aren't a first class type that can be assigned, so to copy one array to another, you have to use a loop:

size_t n = strlen ( src );
size_t i;

for ( i = 0; i < n; i++ )
  dst[i] = src[i];

dst[i] = '\0';

The strcpy function does that for you, more or less.