Technorati Tags:
DEV,
MYSQL,
2008 Hi,
Those of you who has to deal with Mysql, here are the
connection string that can possibly help you.
Have fun.
Ronen
Local database
Driver={mySQL};Server=localhost;Option=16834;Database=myDataBase;
COPY TO CLIPBOARD
Remote database
Driver={mySQL};Server=myServerAddress;Option=131072;Stmt=;Database=myDataBase; User=myUsername;Password=myPassword;
COPY TO CLIPBOARD
Specifying TCP/IP port
Driver={mySQL};Server=myServerAddress;Port=3306;Option=131072;Stmt=;Database=myDataBase; User=myUsername;Password=myPassword;
The driver defaults to port value 3306, if not specified in the connection string, as 3306 is the default port for MySQL.
COPY TO CLIPBOARD
MySQL Connector/ODBC 3.51 (MyODBC 3.51)
Local database
Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=myDataBase; User=myUsername;Password=myPassword;Option=3;
COPY TO CLIPBOARD
Remote database
Driver={MySQL ODBC 3.51 Driver};Server=data.domain.com;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;
COPY TO CLIPBOARD
Specifying TCP/IP port
Driver={MySQL ODBC 3.51 Driver};Server=data.domain.com;Port=3306;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;
The driver defaults to port value 3306, if not specified in the connection string, as 3306 is the default port for MySQL.
COPY TO CLIPBOARD
Specifying character set
Driver={MySQL ODBC 3.51 Driver};Server=data.domain.com;charset=UTF8;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;
COPY TO CLIPBOARD
OLE DB, OleDbConnection (.NET)
Standard
Provider=MySQLProv;Data Source=mydb;User Id=myUsername;Password=myPassword;
COPY TO CLIPBOARD
MySQL Connector/Net (.NET)
Standard
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Default port is 3306.
COPY TO CLIPBOARD
Specifying port
Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Download the driver at MySQL Developer Zone >>
COPY TO CLIPBOARD
Named pipes
Server=myServerAddress;Port=-1;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
It is the port value of -1 that tells the driver to use named pipes network protocol. This is available on Windows only. The value is ignored if Unix socket is used.
COPY TO CLIPBOARD
Multiple servers
Use this to connect to a server in a replicated server configuration without concern on which server to use.
Server=serverAddress1 & serverAddress2 & etc..;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
COPY TO CLIPBOARD
Using encryption
This one activates SSL encryption for all data sent between the client and server. The server needs to have a certificate installed.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Encryption=true;
This option is available from Connector/NET version 5.0.3. In earlier versions, this option has no effect.
COPY TO CLIPBOARD
Specifying default command timeout
Use this one to specify a default command timeout for the connection. Please note that the property in the connection string does not supercede the individual command timeout property on an individual command object.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;default command timeout=20;
This option is available from Connector/NET version 5.1.4.
COPY TO CLIPBOARD
Specifying connection attempt timeout
Use this one to specify the length in seconds to wait for a server connection before terminating the attempt and receive an error.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Connection Timeout=5;
COPY TO CLIPBOARD
Inactivating prepared statements
Use this one to instruct the provider to ignore any command prepare statements and prevent corruption issues with server side prepared statements.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Ignore Prepare=true;
The option was added in Connector/NET version 5.0.3 and Connector/NET version 1.0.9.
COPY TO CLIPBOARD
Specifying port
Use this one to specify what port to use for the connection.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Port=3306;
The port 3306 is the default MySql port.
The value is ignored if Unix socket is used.
COPY TO CLIPBOARD
Specifying network protocol
Use this one to specify which network protocol to use for the connection.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Protocol=socket;
"socket" is the default value used if the key isn't specified. Value "tcp" is an equivalent for "socket".
Use "pipe" to use a named pipes connection, "unix" for a Unix socket connection and "memory" to use MySQL shared memory.
COPY TO CLIPBOARD
Specifying character set
Use this one to specify which character set to use to encode queries sent to the server.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;CharSet=UTF8;
Note that resultsets still are returned in the character set of the data returned.
COPY TO CLIPBOARD
Specifying shared memory name
Use this one to specify the shared memory object name used for the communication.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Shared Memory Name=MYSQL;
This one is applicable only when the connection protocol value is set to "memory".
COPY TO CLIPBOARD
MySqlConnection (.NET)
eInfoDesigns.dbProvider
Data Source=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Command Logging=false;
COPY TO CLIPBOARD
SevenObjects MySqlClient (.NET)
Standard
Host=myServerAddress;UserName=myUsername;Password=myPassword;Database=myDataBase;
COPY TO CLIPBOARD
Core Labs MySQLDirect (.NET)
Standard
User ID=root;Password=myPassword;Host=localhost;Port=3306;Database=myDataBase; Direct=true;Protocol=TCP;Compress=false;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;
COPY TO CLIPBOARD
MySQLDriverCS (.NET)
Standard
Location=myServerAddress;Data Source=myDataBase;User ID=myUsername;Password=myPassword;Port=3306;Extended Properties="""";