Maison > base de données > tutoriel mysql > le corps du texte

MySQL连接字符串的经验总结

WBOY
Libérer: 2016-06-07 16:13:37
original
1317 Les gens l'ont consulté

以下的文章主要向大家讲述的是MySQL连接字符串的经验总结,如果你对MySQL连接字符串相关的实际操作有兴趣的话,你就可以对以下的文章点击观看了。希望会给你带来一些帮助在此方面。 一、MySQL Connector/ODBC 2.50 (MyODBC 2.cv50)连接方式 1、本地数据库连

以下的文章主要向大家讲述的是MySQL连接字符串的经验总结,如果你对MySQL连接字符串相关的实际操作有兴趣的话,你就可以对以下的文章点击观看了。希望会给你带来一些帮助在此方面。
 

一、MySQL Connector/ODBC 2.50 (MyODBC 2.cv50)连接方式

1、本地数据库连接

<ol class="dp-xml"><li class="alt"><span><span class="attribute">Driver</span><span>={MySQL};</span><span class="attribute">Server</span><span>=</span><span class="attribute-value">localhost</span><span>;</span><span class="attribute">Option</span><span>=</span><span class="attribute-value">16834</span><span>;</span><span class="attribute">Database</span><span>=</span><span class="attribute-value">myDataBase</span><span>; </span></span></li></ol>
Copier après la connexion

2、远程数据连接

<ol class="dp-xml"><li class="alt"><span><span class="attribute">Driver</span><span>={MySQL};</span><span class="attribute">Server</span><span>=</span><span class="attribute-value">myServerAddress</span><span>;</span><span class="attribute">Option</span><span>=</span><span class="attribute-value">131072</span><span>;</span><span class="attribute">Stmt</span><span>=;</span><span class="attribute">Database</span><span>=</span><span class="attribute-value">myDataBase</span><span>; </span><span class="attribute">User</span><span>=</span><span class="attribute-value">myUsername</span><span>;</span><span class="attribute">Password</span><span>=</span><span class="attribute-value">myPassword</span><span>; </span></span></li></ol>
Copier après la connexion

3、特殊的TCP/IP端口连接

说明:此Driver的默认端口是3306。如果没有在 MySQL连接字符串中特别指出就是连接MySQL的3306端口。

<ol class="dp-xml"><li class="alt"><span><span class="attribute">Driver</span><span>={MySQL};</span><span class="attribute">Server</span><span>=</span><span class="attribute-value">myServerAddress</span><span>;</span><span class="attribute">Port</span><span>=</span><span class="attribute-value">3306</span><span>;<br></span><span class="attribute">Option</span><span>=</span><span class="attribute-value">131072</span><span>;</span><span class="attribute">Stmt</span><span>=;</span><span class="attribute">Database</span><span>=</span><span class="attribute-value">myDataBase</span><span>; </span><span class="attribute">User</span><span>=</span><span class="attribute-value">myUsername</span><span>;</span><span class="attribute">Password</span><span>=</span><span class="attribute-value">myPassword</span><span>; </span></span></li></ol>
Copier après la connexion

二、MySQL Connector/ODBC 3.51 (MyODBC 3.51)连接方式

1、本地数据库连接

<ol class="dp-xml"><li class="alt"><span><span class="attribute">Driver</span><span>={MySQL ODBC 3.51 Driver};</span><span class="attribute">Server</span><span>=</span><span class="attribute-value">localhost</span><span>;<br></span><span class="attribute">Database</span><span>=</span><span class="attribute-value">myDataBase</span><span>; </span><span class="attribute">User</span><span>=</span><span class="attribute-value">myUsername</span><span>;</span><span class="attribute">Password</span><span>=</span><span class="attribute-value">myPassword</span><span>;</span><span class="attribute">Option</span><span>=</span><span class="attribute-value">3</span><span>; </span></span></li></ol>
Copier après la connexion

2、远程数据连接

<ol class="dp-xml"><li class="alt"><span><span class="attribute">Driver</span><span>={MySQL ODBC 3.51 Driver};</span><span class="attribute">Server</span><span>=</span><span class="attribute-value">data</span><span>.domain.com;<br></span><span class="attribute">Database</span><span>=</span><span class="attribute-value">myDataBase</span><span>;</span><span class="attribute">User</span><span>=</span><span class="attribute-value">myUsername</span><span>; </span><span class="attribute">Password</span><span>=</span><span class="attribute-value">myPassword</span><span>;</span><span class="attribute">Option</span><span>=</span><span class="attribute-value">3</span><span>; </span></span></li></ol>
Copier après la connexion

3、特殊的TCP/IP端口连接

说明:此Driver的默认端口是3306。如果没有在 MySQL连接字符串中特别指出就是连接MySQL的3306端口。

<ol class="dp-xml"><li class="alt"><span><span class="attribute">Driver</span><span>={MySQL ODBC 3.51 Driver};</span><span class="attribute">Server</span><span>=</span><span class="attribute-value">data</span><span>.domain.com;</span><span class="attribute">Port</span><span>=</span><span class="attribute-value">3306</span><span>;<br></span><span class="attribute">Database</span><span>=</span><span class="attribute-value">myDataBase</span><span>;</span><span class="attribute">User</span><span>=</span><span class="attribute-value">myUsername</span><span>; </span><span class="attribute">Password</span><span>=</span><span class="attribute-value">myPassword</span><span>;</span><span class="attribute">Option</span><span>=</span><span class="attribute-value">3</span><span>; </span></span></li></ol>
Copier après la connexion

4、特殊字符集的连接

<ol class="dp-xml"><li class="alt"><span><span class="attribute">Driver</span><span>={MySQL ODBC 3.51 Driver};</span><span class="attribute">Server</span><span>=</span><span class="attribute-value">data</span><span>.domain.com;<br></span><span class="attribute">charset</span><span>=</span><span class="attribute-value">UTF8</span><span>;</span><span class="attribute">Database</span><span>=</span><span class="attribute-value">myDataBase</span><span>;</span><span class="attribute">User</span><span>=</span><span class="attribute-value">myUsername</span><span>; </span><span class="attribute">Password</span><span>=</span><span class="attribute-value">myPassword</span><span>;</span><span class="attribute">Option</span><span>=</span><span class="attribute-value">3</span><span>; </span></span></li></ol>
Copier après la connexion

三、OLE DB, OleDbConnection (.NET)连接方式

1、标准连接

<ol class="dp-xml"><li class="alt"><span><span class="attribute">Provider</span><span>=</span><span class="attribute-value">MySQLProv</span><span>;Data </span><span class="attribute">Source</span><span>=</span><span class="attribute-value">mydb</span><span>;User </span><span class="attribute">Id</span><span>=</span><span class="attribute-value">myUsername</span><span>;</span><span class="attribute">Password</span><span>=</span><span class="attribute-value">myPassword</span><span>; </span></span></li></ol>
Copier après la connexion

上述的相关内容就是对 MySQL连接字符串总结的部分内容描述,希望会给你带来一些帮助在此方面。


Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal