ODBC

...now browsing by tag

 
 

Setting up MySQL ODBC (Windows)

Friday, March 20th, 2009

Download the mysql ODBC connector from here.  This is a link to the 3.51 driver which seems to work fine.  I have not tried the 5.1 driver.

Install the program.

Go to windows control panel -> Administrative Tool and select “ODBC Data Source administrator“.  Select the “System DSN” tab.

ODBC Data Source Page

ODBC Data Source Administrator

Click ‘Add‘, and select “MySQL ODBC 3.1 driver“.

Create new data source

Create new data source

Then click ‘Finish‘.

The following screen will appear:

MySQL ODBC Connector Login Information

MySQL ODBC Connector Login Information

Enter the following values:

  1. Data source name – This will be the name that you will use to refer to the data source in programs such as Access, Outlook and Excel.  Use something short like ‘payment-prod’.
  2. Description - optional – can be used to describe the datasource.
  3. Server - this will be localhost if your MySQL database is installed locally, otherwise the same name as your web domain.  e.g. centella.co.uk.
  4. User - user name.
  5. Password - users password.
  6. Database - name of the database you want to connect to.

Click on the connect options tab.  Set the “Initial statement” to:

Set wait_timeout=28800

Connect options

Connect options

This setting is required because most MySQL installations are set to automatically disconnect from the client after 20s.  When you are working on ODBC data sources in programs such as Access, they will not re-connect to a datasource automatically.  If you do not set the wait_timeout value, you will get “server has gone away” error messages.

Click “Test” to test the connection.

Twitter It!