博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
delphi连接mysql不用添加DSN(mysql connector odbc 5.1版)
阅读量:6844 次
发布时间:2019-06-26

本文共 1839 字,大约阅读时间需要 6 分钟。

一、下载安装mysql驱动

二、添加adoconnection,adoquery,使用以下连接字符串
adoconnection的属性ConnectionString填入以下所需要的连接情况对应字符串,在软件发布时,把mysql-connector-odbc-5.1.8-win32.msi安装程序一起附带着,先安装驱动,即可正常使用。

Local database
Driver= {MySQL ODBC 5.1 Driver}; Server= localhost; Database= myDataBase; User= myUsername; Password= myPassword; Option= 3;
 
Remote database
Driver= {MySQL ODBC 5.1 Driver}; Server= myServerAddress; Database= myDataBase; User= myUsername; Password= myPassword; Option= 3;
 
Specifying TCP/IP port
Driver= {MySQL ODBC 5.1 Driver}; Server= myServerAddress; Port= 3306; Database= myDataBase; User= myUsername; Password= myPassword; Option= 3;
 
Specifying character set
Driver= {MySQL ODBC 5.1 Driver}; Server= myServerAddress; charset= UTF8; Database= myDataBase; User= myUsername; Password= myPassword; Option= 3;
 
Specifying socket
This one specifies the Unix socket file or Windows named pipe to connect to. Used only for local client connections.
Driver= {MySQL ODBC 5.1 Driver}; Server= myServerAddress; Database= myDataBase; User= myUsername; Password= myPassword; Socket= MySQL; Option= 3;
On Windows, the socket variable is the name of the named pipe that is used for local client connections. The default value is MySQL.
On Unix platforms, the socket variable is the name of the socket file that is used for local client connections. The default is /tmp/mysql.sock.
 
Using SSL
Driver= {MySQL ODBC 5.1 Driver}; Server= myServerAddress; Database= myDataBase; User= myUsername; Password= myPassword; sslca= c:/cacert.pem; sslcert= c:/client-cert.pem; sslkey= c:/client-key.pem; sslverify= 1; Option= 3;
SSLCA specifies the path to a file with a list of trust SSL CAs
SSLCERT specifies the name of the SSL certificate file to use for establishing a secure connection.
SSLKEY specifies the name of the SSL key file to use for establishing a secure connection.

转载地址:http://zkdul.baihongyu.com/

你可能感兴趣的文章
Linux下面搭建***服务器(pptp)
查看>>
Spring IOC笔记
查看>>
如何解决 homebrew 更新慢的问题
查看>>
磁盘配额满与用户权限的更改
查看>>
ORACLE 数据类型
查看>>
KeyMob移动广告聚合平台为开发者提供最全面的保障
查看>>
钱sir 高数:一元函数积分学
查看>>
修改Windows server 2008远程桌面连接数量
查看>>
Excel文件导入异常-输入流无法识别
查看>>
我的友情链接
查看>>
CentOS6.4下YUM安装MySQL和JDK和Tomcat
查看>>
LVS解析及NAT、DR模型配置详解
查看>>
上期ctp期货API android 客户端
查看>>
puppet实战(一):文件同步+更改文件属性
查看>>
最简单的git部署方案
查看>>
js获取url参数值
查看>>
让MAC的终端显示颜色
查看>>
android开发-----message
查看>>
SVN分支/合并原理及最佳实践 (很实用,很不错哦)
查看>>
Hyper-V 3.0功能部署PART 8:计划故障转移
查看>>