MySQL Connector/Net connection strings

You can use these connections strings as refences when using the connection string option to connect to your MySQL database.

Standard:
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;

Specifying TCP port
Server=myServerAddress;Port=1234;Uid=myUsername;Pwd=myPassword;

Multiple servers
Server=serverAddress1, serverAddress2, serverAddress3;Uid=myUsername;Pwd=myPassword;

Using encryption (old)
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;Encrypt=true;

Using encryption (new)
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;SslMode=Preferred;

Force encryption
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;SslMode=Required;

SSL with a file-based certificate
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;SSL Mode=Required;CertificateFile=C:\folder\client.pfx;CertificatePassword=pass;

SSL with a personal store-based certificate
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;SSL Mode=Required;Certificate Store Location=CurrentUser;

SSL with a thumbprint specific personal store-based certificate
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;SSL Mode=Required;Certificate Store Location=CurrentUser;Certificate Thumbprint=479436009a40f3017a145cf8479e7694d7aadef0;

Disallow batches
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;AllowBatch=False;

Allow User Variables
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;AllowUserVariables=True;

Invalid DateTime's 1
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;AllowZeroDateTime=True;

Invalid DateTime's 2
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;ConvertZeroDateTime=True;

Disable transaction participation
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;AutoEnlist=False;

Skip parameter checks for stored routines
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;CheckParameters=False;

Skip parameter type and order matching for stored procedures
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;UseProcedureBodies=False;

Use Table Caching
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;tablecache=true;DefaultTableCacheAge=30;

Count changed rows instead of found rows
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;UseAffectedRows=True;

Compress network communication between client and server
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;UseCompression=True;

Log inefficient database operations
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;UseUsageAdvisor=True;

Enable performance counters
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;UsePerformanceMonitor=True;

Connection Pooling
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;Pooling=True;

Connection Pool size
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;MinimumPoolSize=10;maximumpoolsize=50;

Disable connection pooling
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;Pooling=False;

Connection state reset when obtained from pool
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;ConnectionReset=True;

Recycle connections in pool
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;ConnectionLifeTime=300;

Do not update server settings on connections in pool
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;CacheServerProperties=True;

Use Windows authentication
Server=myServerAddress;IntegratedSecurity=yes;Uid=auth_windows;

Keep TCP Sockets alive
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;Keepalive=10;

Use BINARY(16) GUIDs
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;OldGuids=True;

Disable Stored procedure cache
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;ProcedureCacheSize=0;

Allow square brackets around symbols (instead of backticks)
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;sqlservermode=True;

Specifying default command timeout
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;default command timeout=20;

Specifying connection attempt timeout
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;Connection Timeout=5;

Inactivating prepared statements
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;Ignore Prepare=true;

Specifying network protocol
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;Protocol=socket;

Shared memory protocol
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;Protocol=memory;Shared Memory Name=MYSQL;

Named pipes protocol
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;Protocol=pipe;PipeName=mypipename;

Named pipes alternative
Server=myServerAddress;Port=-1;Uid=myUsername;Pwd=myPassword;

Unix socket connection
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;Protocol=memory;Shared Memory Name=MYSQL;

Specifying character set
Server=myServerAddress;Uid=myUsername;Pwd=myPassword;CharSet=utf8;

Powered by BetterDocs