一、下载安装mysql驱动
http://mysql.com/downloads/connector/odbc/
二、添加adoconnection,adoquery,使用以下连接字符串
http://www.connectionstrings.com/mysql#p31
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.

delphi连接mysql不用添加DSN(mysql connector odbc 5.1版)的更多相关文章

  1. delphi 连接mysql

    Delphi连接MySQL真麻烦,研究了一天,从网上找了无数文章,下载了无数插件都没解决.最后返璞归真,老老实实用ADO来连接,发现也不是很顺利,但最终还是连接成功了.多少有点心得:ADO各个组件的作 ...

  2. mysql中添加一个和root一样的用户用于远程连接

    mysql中添加一个和root一样的用户用于远程连接: 大家在拿站时应该碰到过.root用户的mysql,只可以本地连,对外拒绝连接. 下面语句添加一个新用户administrtor: CREATE ...

  3. Delphi连接MySql(待测试验证,使用mysql.pas未通过)

    要在一个Delphi程序中调用Mysql数据库,查到有个资料如下,待验证,验证后会给出结果.暂时做个标记 已经验证,验证日期:2018.6.18 验证结果:不可行 验证工具:XE7,mysql5.5. ...

  4. MySQL Connector/ODBC 2.50 (MyODBC 2.50)连接方式

    一.MySQL Connector/ODBC 2.50 (MyODBC 2.50)连接方式 1.本地数据库连接Driver={MySQL};Server=localhost;Option=16834; ...

  5. sql 2008 R2添加对MySql的远程服务器链接

    (1).我的sql 2008 R2所在的系统为Windows server 2008 *64 (2).MySQL所在的系统为Windows server 2003 *86 我想要实现的是在sql 20 ...

  6. PHP连接MySQL报错:SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket 'MySQL' (2)

    如下所示,PHP连接MySQL报错: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket 'MySQL' ...

  7. MySQL连接问题【如何解决MySQL连接超时关闭】

    --MySQL连接问题[如何解决MySQL连接超时关闭] ------------------------------------------------转载 最近做网站有一个站要用到WEB网页采集器 ...

  8. c/c++连接mysql数据库设置及乱码问题(vs2013连接mysql数据库,使用Mysql API操作数据库)

    我的安装环境: (1)vs2013(32位版) (vs2013只有32位的 没有64位的,但是它可以编译出64位的程序)  : (2)mysql-5.7.15(64位) vs2013中的设置(按步骤来 ...

  9. c++连接mysql数据库(使用mysql api方式,环境VS2013+MYSQL5.6)

    转载请注明出处,原文地址http://www.cnblogs.com/zenki-kong/p/4382657.html 刚开始写博客,博主还只是个大三汪,学艺不精,如有错误还请前辈指出(>^ω ...

随机推荐

  1. 关于USBHID协议以及鼠标键盘描述符的解释【转】

    转自:https://blog.csdn.net/jiujiujiuqiuqiuqiu/article/details/47277685 一.HID设备识别 前面有提到关于SCSI协议的USB设备实现 ...

  2. H5开发APP考题和答案

    { "last_updated": { "$date": 1544276670569 }, "page_count": 1, "a ...

  3. Mysql读写分离-Amoeba Proxy

    参考:http://www.linuxidc.com/Linux/2015-10/124115.htm 一个完整的MySQL读写分离环境包括以下几个部分: 应用程序client database pr ...

  4. 探秘Java类加载

    Java是一门面向对象的编程语言. 面向对象以抽象为基础,有封装.继承.多态三大特性. 宇宙万物,经过抽象,均可归入相应的种类.不同种类之间,有着相对井然的分别. Java中的类,便是基于现实世界中的 ...

  5. day25作业

    1.阻塞  2.就绪  3.阻塞  4.Runnable  5.join()  6.synchronized  7.notify()和notifyAll()   8.Object 1.A   2.D  ...

  6. TcxGrid 内容 行高度

  7. PHP 操作redis 封装的类 转的

    <?php/** * Redis 操作,支持 Master/Slave 的负载集群 * * @author jackluo */class RedisCluster{           // ...

  8. Python学习笔记之爬取网页保存到本地文件

     爬虫的操作步骤: 爬虫三步走 爬虫第一步:使用requests获得数据: (request库需要提前安装,通过pip方式,参考之前的博文) 1.导入requests 2.使用requests.get ...

  9. .NET工作准备--03进阶知识

    (已过时) 高级特性,多线程编程,单元测试; 第一部分 .net高级特性 1.委托:提供安全的函数回调机制; *基本原理:与C++中的函数指针相似;安全--它和其他所有.net成员一样是一种类型,任何 ...

  10. Spring框架学习——Spring的体系结构详解

    1.Spring简介 Spring是一个轻量级Java开发框架,最早有Rod Johnson创建,目的是为了解决企业级应用开发的业务逻辑层和其他各层的耦合问题.它是一个分层的JavaSE/JavaEE ...