title: Use mysql embedded and --local-infile=1 with c++?
body: <p>I am connecting to a mysql database using the embedding server (linking against mysqld) in c++. I have the following code:</p>
  
  <pre><code>static char *server_options[] = \
          { (char *)"mysql_test",
            (char *)"--datadir=/home/cquiros/temp/mysql/db2",
            (char *)"--default-storage-engine=MyISAM",
            (char *)"--loose-innodb=0",
            (char *)"--local-infile=1",
            (char *)"--skip-grant-tables=1",
            (char *)"--myisam-recover=FORCE",
            (char *)"--key_buffer_size=16777216",
            (char *)"--character-set-server=utf8",
            (char *)"--collation-server=utf8_bin",
            NULL };
  
          int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
  
          mysql_library_init(num_elements, server_options, NULL);
          m_mysql = mysql_init(NULL);
  
          char enable_load_infile = 1;
          if (mysql_options(m_mysql,MYSQL_OPT_LOCAL_INFILE, (const char *)&amp;(enable_load_infile)))
              qDebug() &lt;&lt; "Error setting option";
  
          mysql_real_connect(m_mysql, NULL,NULL,NULL, "database1", 0,NULL,0);
  </code></pre>
  
  <p>The connection works and I can query and create tables however, when I try to execute "load data local infile ..." I always get "The used command is not allowed with this MySQL version" even though I am setting --local-infile=1 in the server options or setting it in code in:</p>
  
  <pre><code>char enable_load_infile = 1;
          if (mysql_options(m_mysql,MYSQL_OPT_LOCAL_INFILE, (const char *)&amp;(enable_load_infile)))
              qDebug() &lt;&lt; "Error setting option";
  </code></pre>
  
  <p>Any idea what I am doing wrong and how to fix it?</p>
  
  <p>Many thanks for your help.
  Carlos.</p>