title: MySQL Connector for C- Connect to remote database
body: <p>I'm using MySQL Connector (for C) to attempt to connect to a remote database. However, my code fails to instantiate a connection to a remote database. Here's the code </p>
  
  <pre><code>    MYSQL *conn;
      MYSQL_RES *res;
      MYSQL_ROW row;
      char *server = "192.168.1.114";
      char *user = "root";
      char *password = "PASSWORD_STUB"; /* set me first */
      char *database = "tmp";
      conn = mysql_init(NULL);
      /* Connect to database */
      if (!mysql_real_connect(conn, server,
                              user, password, database, 3306, NULL, 0)) {
         printf("ERROR CODE %u: %s", mysql_errno(conn),mysql_error(conn) );
  
      }else{
         printf("Connected..");
      }
  </code></pre>
  
  <p>The output from the error is </p>
  
  <pre><code>ERROR CODE 1045: Access denied for user 'root'@'192.168.1.100' (using password: YES)
  </code></pre>
  
  <p>Am I attempting to connect to the server correctly? The IP in the error code is the IP of my machine NOT the IP of the remote host. </p>