title: Unable to connect to remote mysql server using unixodbc, libmyodbc
body: <p>I'm a little green at this, and I hope the issue I'm having is a simple one...edit: new information at bottom</p>
  
  <p>I need to make a connection to a remote mysql (Amazon RDS) database.</p>
  
  <p>After following a few tutorials, I have unixodbc and libmyodbc installed and configured on the client, but when I try to connect via isql, I get the error </p>
  
  <pre><code>[08S01][unixODBC][MySQL][ODBC 5.1 Driver]Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
  [ISQL]ERROR: Could not SQLConnect
  </code></pre>
  
  <p>The most confusing part about this error is that I'm not trying to connect to a local database, but rather to a remote one. I do not have a mysql.sock file on the client...this isn't the issue though is it?</p>
  
  <p>I'm sensing a configuration error but I'm just not sure what it could be.</p>
  
  <p>If I run odbcinst -j then the output is:</p>
  
  <pre><code>DRIVERS............: /etc/unixODBC/odbcinst.ini
  SYSTEM DATA SOURCES: /etc/unixODBC/odbc.ini
  USER DATA SOURCES..: /root/.odbc.ini
  </code></pre>
  
  <p>The content of /etc/unixODBC/odbcinst.ini is:</p>
  
  <pre><code>[MySQL]
  Description             = ODBC for MySQL
  Driver          = /usr/lib64/libmyodbc5.so
  Setup           = /usr/lib64/unixODBC/libodbcmyS.so
  UsageCount              = 5
  
  [MySQL ODBC 515 Driver]
  Description             = ODBC 5.515 for MySQL
  DRIVER          = /usr/lib64/libmyodbc5-5.1.5.so
  SETUP           = /usr/lib64/unixODBC/libodbcmyS.so
  UsageCount              = 3
  </code></pre>
  
  <p>Please note that I had to make up this configuration myself, I did a find for libmyodbc* and found these two .so files, thus set up a driver for each of them. A search for libodbcmyS* yields:</p>
  
  <pre><code>/usr/lib64/unixODBC/libodbcmyS.so.1
  /usr/lib64/unixODBC/libodbcmyS.so
  /usr/lib64/unixODBC/libodbcmyS.so.1.0.0
  </code></pre>
  
  <p>So, I don't know what else that configuration could be.</p>
  
  <p>The content of /etc/unixODBC/odbc.ini is:</p>
  
  <pre><code>[target_db]
  Driver          = MySQL
  Server          = [servername.com]
  Port            = 3306
  Database        = [databasename]
  Option          = 2
  User            = [username]
  Password        = [password]
  </code></pre>
  
  <p>I've tried different options in "Driver", changing it from MySQL, to MySQL ODBC 515 Driver, to the path to the .so file (eg: /usr/lib64/libmyodbc5.so) and all yield the same result.</p>
  
  <p>I'm running:</p>
  
  <pre><code>odbcinst -i -d -f /etc/unixODBC/odbcinst.ini
  </code></pre>
  
  <p>Followed by: </p>
  
  <pre><code>odbcinst -i -s -l -f /etc/unixODBC/odbc.ini
  </code></pre>
  
  <p>Followed by:</p>
  
  <pre><code>odbcinst -s -q
  </code></pre>
  
  <p>Which prints out the name of my connection, ie [target_db]</p>
  
  <p>Then, I try the connect:</p>
  
  <pre><code>isql -v target_db user password
  </code></pre>
  
  <p>or just</p>
  
  <pre><code>isql -v target_db
  </code></pre>
  
  <p>and get the error shown above.</p>
  
  <p>Anyone happen to know what I'm doing wrong here? Thanks a bunch-</p>
  
  <p>EDIT:</p>
  
  <p>Wanted to mention that I'm able to connect to the database from this server using the mysql command line tools.</p>
  
  <p>I installed a local mysql database, and I'm able to connect to this using isql. It seems to be ignoring my odbc.ini file entirely, i have to enter a name with the command, ie isql -v test-database, but it still tries to connect to localhost despite my settings.</p>
  
  <p>I feel as though I've tried everything but will keep at it and will post if i find a solution.</p>