Several important steps in the MySQL connection string

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

In the previous article, we gave a detailed introduction to the practical operation experience and practical operation skills of MySQL connection strings, this article mainly introduces the actual operation steps of MySQL connection strings in practice.

MySQL connection string: MySQL Connector/Net (. NET) Connection Method

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

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

2. Special TCP/IP Port connection

 
 
  1. 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.

 
 
  1. 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.

 
 
  1. 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.

 
 
  1. 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.

 
 
  1. 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)

 
 
  1. 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.

 
 
  1. 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.

 
 
  1. 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.

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

11. Special Character Set connection

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

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

 
 
  1. 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.

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

MySQL connection string: MySQLConnection (. NET) Connection Method

1. eInfoDesigns. dbProvider

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

SevenObjects MySQLClient (. NET) Connection Method

1. Standard connection

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

Core Labs MySQLDirect (. NET) Connection Method

1. Standard connection

 
 
  1. 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; 

MySQL connection string: MySQLDriverCS (. NET) Connection Method

1. Standard connection

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

The above content is an introduction to the MySQL connection string, and I hope you will get something.

Related Article

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.