delphi连接mysql不用添加DSN(mysql connector odbc 5.1版)

一、下载安装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.

转自:https://blog.csdn.net/arbin_he/article/details/6368396

原文地址:https://www.cnblogs.com/railgunman/p/12121199.html

时间: 2024-08-28 22:14:04

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

Mysql (一)Mysql 在Linux系统安装

引言 现在因为项目的需要在搭建Mysql的集群,从最简单的开始,先安装一个Mysql 在linux系统下. 步骤: 第一步:安装: tar mysql-5.5.48-linux2.-x86_64.tar.gz Copy到指定的路径下: cp mysql-5.5.48-linux2.6-x86_64 /usr/local/mysql -r 添加系统mysql组合mysql用户: 执行命令:groupaddmysql和useradd -r -g mysql mysql 安装数据库: 进入安装mysq

delphi 连接mysql

Delphi连接MySQL真麻烦,研究了一天,从网上找了无数文章,下载了无数插件都没解决.最后返璞归真,老老实实用ADO来连接,发现也不是很顺利,但最终还是连接成功了.多少有点心得:ADO各个组件的作用和联系必须清楚,否则设置起来很容易混乱.总结一下用ADO连接MySQL5.1要点: 1.需要下载MySQL的ODBC支持,我用的官网mysql-connector-odbc-5.1.7-win32.msi(这个一般没问题,下载安装即可) 2.通过ODBC管理建立系统DSN(这个也简单,无非是选择M

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

mysql中添加一个和root一样的用户用于远程连接: 大家在拿站时应该碰到过.root用户的mysql,只可以本地连,对外拒绝连接. 下面语句添加一个新用户administrtor: CREATE USER 'monitor'@'%' IDENTIFIED BY 'admin'; GRANT ALL PRIVILEGES ON *.* TO 'monitor'@'%' IDENTIFIED BY 'admin' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0

Linux 安装mysql并添加远程连接账号

1.yum -y install wget   已安装wget可跳过 2. 下载安装 wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm yum update 更新软件与系统可跳过 yum install mysql-server 3.权限设置:chown mysql:mysql -R /var/lib/mysql

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

(1).我的sql 2008 R2所在的系统为Windows server 2008 *64 (2).MySQL所在的系统为Windows server 2003 *86 我想要实现的是在sql 2008 R2数据库直接访问MySQL数据库的数据. 1.安装MySQL ODBC connector5.3.4 http://dev.mysql.com/downloads/connector/odbc/ 2. 安装MySQL ODBC connector5.3.4驱动提示如下问题: Error 19

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' (2) 测试代码如下: <?php try { $dsn = 'mysql:dbname=php-note;host=localhost;port=3306;charset=utf8'; $username = 'root'; $password = 'root'; new PDO( $dsn,

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

--MySQL连接问题[如何解决MySQL连接超时关闭] ------------------------------------------------转载 最近做网站有一个站要用到WEB网页采集器功能,当一个PHP脚本在请求URL的时候,可能这个被请求的网页非常慢慢,超过了mysql的 wait-timeout时间,然后当网页内容被抓回来后,准备插入到MySQL的时候,发现MySQL的连接超时关闭了,于是就出现了"MySQL server has gone away"这样的错误提示

Ansible 从MySQL数据库添加或删除用户

mysql_user - 从MySQL数据库添加或删除用户. 概要 要求(在执行模块的主机上) 选项 例子 笔记 状态 支持 概要 从MySQL数据库添加或删除用户. 要求(在执行模块的主机上) MySQLdb的 选项 参数 需要 默认 选择 注释 append_privs (1.4 加入) no no yes no 将priv定义的权限附加到此用户的现有权限,而不是覆盖现有的权限. check_implicit_admin (1.3 加入) no no yes yes 检查mysql是否允许以

13.1 设置更改root密码;13.2 连接MySQL;13.3 MySQL常用命令

扩展 : mysql5.7 root密码更改 http://www.apelearn.com/bbs/thread-7289-1-1.html myisam 和innodb引擎对比 http://www.pureweber.com/article/myisam-vs-innodb/ mysql 配置详解: http://blog.linuxeye.com/379.html mysql调优: http://www.aminglinux.com/bbs/thread-5758-1-1.html 同学