0% found this document useful (0 votes)
38 views2 pages

MySQL Connection String

The document discusses different connection string options for connecting to a MySQL database using ODBC drivers on both 32-bit and 64-bit machines locally or remotely. It provides examples of connection strings specifying the driver, server, database, username, password and additional options like TCP/IP port, character set, socket, and SSL encryption.

Uploaded by

Erfian COC
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views2 pages

MySQL Connection String

The document discusses different connection string options for connecting to a MySQL database using ODBC drivers on both 32-bit and 64-bit machines locally or remotely. It provides examples of connection strings specifying the driver, server, database, username, password and additional options like TCP/IP port, character set, socket, and SSL encryption.

Uploaded by

Erfian COC
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

MySQL

MySQL

Local database

Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=myDataBase;


User=myUsername;Password=myPassword;Option=3;

MySQL

On 64 bit machine

It seems we need to point on MSDASQL for the (32 bit) ODBC driver to work on 64 bit machines.

Provider=MSDASQL;Driver={MySQL ODBC 5.1 Driver};Server=localhost;


Database=myDataBase;User=myUsername;Password=myPassword;Option=3;

MySQL

64 bit version of the driver

Note the "w" in the driver name.

Driver={MySQL ODBC 5.2w Driver};Server=localhost;Database=myDataBase;


User=myUsername;Password=myPassword;Option=3;

Version 5.2.5 new name

MySQL ODBC Connector version 5.2.5 and above register itself as "MySQL ODBC 5.2 Unicode Driver" and
"MySQL ODBC 5.2 ANSI Driver".

Driver={MySQL ODBC 5.2 ANSI Driver};Server=localhost;Database=myDataBase;


User=myUsername;Password=myPassword;Option=3;

See version 5.2 connection strings HERE MySQL

Remote database

Driver={MySQL ODBC 5.1 Driver};Server=myServerAddress;Database=myDataBase;


User=myUsername;Password=myPassword;Option=3;

MySQL

Specifying TCP/IP port

Driver={MySQL ODBC 5.1 Driver};Server=myServerAddress;Port=3306;


Database=myDataBase;User=myUsername;Password=myPassword;Option=3;

The driver defaults to port value 3306, if not specified in the connection string,
MySQL
as 3306 is the default port for MySQL.
Specifying character set

Driver={MySQL ODBC 5.1 Driver};Server=myServerAddress;charset=UTF8;


Database=myDataBase;User=myUsername;Password=myPassword;Option=3;

MySQL

Specifying socket

This one specifies the Unix socket file or Windows named pipe to connect to. Used only for local client
connections.

Driver={MySQL ODBC 5.1 Driver};Server=myServerAddress;Database=myDataBase;


User=myUsername;Password=myPassword;Socket=MySQL;Option=3;

On Windows, the socket variable is the name of the named pipe that is used for
local client connections. The default value is MySQL.
MySQL
On Unix platforms, the socket variable is the name of the socket file that is used
for local client connections. The default is /tmp/mysql.sock.

Using SSL

Driver={MySQL ODBC 5.1 Driver};Server=myServerAddress;Database=myDataBase;


User=myUsername;Password=myPassword;sslca=c:\cacert.pem;
sslcert=c:\client-cert.pem;sslkey=c:\client-key.pem;sslverify=1;Option=3;

You might also like