Summary of the actual operation steps for MySQL connection strings

Source: Internet
Author: User
Tags mysql connection string ssl connection

This article mainly describes the summary of the actual operation steps for MySQL connection strings, including the connection methods of MySQL ctor/ODBC 2.50 (MyODBC 2.50), MySQL Connector/ODBC 3.51 (MyODBC 3.51) the connection method and other related content.

I. MySQL Connector/ODBC 2.50 (MyODBC 2.50) Connection Mode

1. Local Database Connection

Driver = {MySQL}; Server = localhost; Option = 16834; Database = myDataBase;
 

2. Remote Data Connection

Driver = {MySQL}; Server = myServerAddress; Option = 131072; Stmt =; Database = myDataBase; User = myUsername; Password = myPassword;
 

3. Special TCP/IP Port connection

Note: The default port of this Driver is 3306. If it is not specified in the MySQL connection string, port 3306 is connected to MySQL.

Driver = {MySQL}; Server = myServerAddress; Port = 3306; Option = 131072; Stmt =; Database = myDataBase; User = myUsername; Password = myPassword;
 

Ii. MySQL Connector/ODBC 3.51 (MyODBC 3.51) Connection Mode

1. Local Database Connection

Driver = {MySQL ODBC 3.51 Driver}; Server = localhost; Database = myDataBase; User = myUsername; Password = myPassword; Option = 3;
 

2. Remote Data Connection

Driver = {MySQL ODBC 3.51 Driver}; Server = data.domain.com; Database = myDataBase; User = myUsername; Password = myPassword; Option = 3;
 

3. Special TCP/IP Port connection
Note: The default port of this Driver is 3306. If it is not specified in the MySQL connection string, port 3306 is connected to MySQL.

Driver = {MySQL ODBC 3.51 Driver}; Server = data.domain.com; Port = 3306; Database = myDataBase; User = myUsername; Password = myPassword; Option = 3;
 

4. Special Character Set connection

Driver = {MySQL ODBC 3.51 Driver}; Server = data.domain.com; charset = UTF8; Database = myDataBase; User = myUsername; Password = myPassword; Option = 3;
 

Iii. ole db, OleDbConnection (. NET) Connection Method

1. Standard connection

Provider = MySQLProv; Data Source = mydb; User Id = myUsername; Password = myPassword;
 

Iv. MySQL ctor/Net (. NET) Connection Method

1. Standard connection (the default port is 3306 .)

Server = myServerAddress; Database = myDataBase; Uid = myUsername; Pwd = myPassword;
 

2. Special TCP/IP Port connection

Server = myServerAddress; Port = 1234; Database = myDataBase; Uid = myUsername; Pwd = myPassword;
 

3. Named Pipe

Note: If the port value is-1, the connection is established using the named pipe. This method is only valid in Windows and is ignored in UNIX.

Server = myServerAddress; Port =-1; Database = myDataBase; Uid = myUsername; Pwd = myPassword;
 

4. multi-server connection

You do not have to worry about which database to connect.

Server = serverAddress1 & serverAddress2 & etc ..; Database = myDataBase; Uid = myUsername; Pwd = myPassword;
 

5. Encryption options

This active SSL connection encrypts data transmission between all clients and server vendors. The server must have a certificate.

This option is available from Connector/NET5.0.3, which is unavailable in previous versions.

Server = myServerAddress; Port =-1; Database = myDataBase; Uid = myUsername; Pwd = myPassword;
 

6. Modify the default command timeout time
 

Use this command to modify the default connection timeout time. Note: This does not affect the timeout value you set on a single command object.

This entry is only valid for Connector/NET 5.1.4 and later versions.

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

7. Modify the connection time
 

Use this modification to terminate the retry and receive the error wait time (in seconds)

Server = myServerAddress; Database = myDataBase; Uid = myUsername; Pwd = myPassword; Connection Timeout = 5;
 

8. Inactivating prepared statements
 

Use this one to instruct the provider to ignore any command prepare statements and prevent upload uption issues with server side prepared statements.

This option is added to the 5.0.3 and 1.0.9 versions of Connector/NET.

Server = myServerAddress; Database = myDataBase; Uid = myUsername; Pwd = myPassword; Ignore Prepare = true;
 

9. Special TCP/IP Port connection

This statement modifies the connected port.

The default port is 3306. This parameter is ignored by Unix.

Server = myServerAddress; Database = myDataBase; Uid = myUsername; Pwd = myPassword; Port = 3306;
 

10. Special network protocols

This statement modifies the protocol used for connection.

Unless otherwise specified, "socket" is the default value. "Tcp" is of the same significance as "socket. "Pipe" uses named pipe connections, "unix" uses unix socket connections, and "memory" uses MySQL shared memory.

Server = myServerAddress; Database = myDataBase; Uid = myUsername; Pwd = myPassword; Protocol = socket;
 

11. Special Character Set connection

This statement indicates the query statement that sends the MySQL connection string encoding to the server.

Note: The query results are still transmitted in reverse data format.

Server = myServerAddress; Database = myDataBase; Uid = myUsername; Pwd = myPassword; CharSet = UTF8;
 

12. Modify the shared memory name

This statement is used to modify the name of the shared memory used for communication.

Note: This statement is valid only when the connection protocol is set to "memory.

Server = myServerAddress; Database = myDataBase; Uid = myUsername; Pwd = myPassword; Shared Memory Name = MySQL;
 

V. MySQLConnection (. NET) Connection Method

1. eInfoDesigns. dbProvider

Data Source = myServerAddress; Database = myDataBase; User ID = myUsername; Password = myPassword; Command Logging = false;
 

Vi. SevenObjects MySQLClient (. NET) Connection Method

1. Standard connection

Host = myServerAddress; UserName = myUsername; Password = myPassword; Database = myDataBase;
 

VII. Core Labs MySQLDirect (. NET) Connection Method

1. Standard connection

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;
 

VIII. MySQLDriverCS (. NET) Connection Method

1. Standard connection

Location = myServerAddress; Data Source = myDataBase; User ID = myUsername; Password = myPassword; Port = 3306; Extended Properties = """";
 

Original article title: [MySQL]-MySQL connection string Summary

Connection: http://www.cnblogs.com/hcbin/archive/2010/05/04/1727071.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.