Mysql ODBC 5.1 Driver免安装脚本
在使用Mysql 的时候,需要使用ODBC数据源的方式来连接mysql,所以常常需要用到免安装的驱动,自己参考官网的脚本,
修改了一个实用点的脚本,放出来大家一起分享:
安装mysql odbc 5.1 Driver
- @ECHO OFF
- SET installdir=none
- IF EXIST %windir%/system/nul SET installdir=%windir%/system
- IF EXIST %windir%/system32/nul SET installdir=%windir%/system32
- IF %installdir%==none GOTO :doError5
- IF EXIST %installdir%/myodbc-installer.exe GOTO :doError4
- REM ****
- REM * Find out the bin/lib directory, or use default
- REM ****
- SET libdir=lib
- SET bindir=bin
- IF EXIST lib/release/myodbc5.lib SET libdir=lib/release
- IF EXIST lib/relwithdebinfo/myodbc5.lib SET libdir=lib/relwithdebinfo
- IF EXIST bin/release/myodbc-installer.exe SET bindir=bin/release
- IF EXIST bin/relwithdebinfo/myodbc-installer.exe SET bindir=bin/relwithdebinfo
- REM ****
- REM * Copying myodbc libraries and executables to install dir...
- REM ****
- ECHO Copying installation files
- IF NOT EXIST %libdir%/myodbc5.lib GOTO :doError2
- IF NOT EXIST %libdir%/myodbc5S.lib GOTO :doError2
- IF NOT EXIST %bindir%/myodbc-installer.exe GOTO :doError2
- copy %libdir%/myodbc5S.dll %installdir%
- copy %libdir%/myodbc5S.lib %installdir%
- copy %libdir%/myodbc5.dll %installdir%
- copy %libdir%/myodbc5.lib %installdir%
- copy %bindir%/myodbc-installer.exe %installdir%
- copy doc/*.hlp %installdir%
- REM ****
- REM * Registering driver...
- REM *
- REM * We can do this with myodbc-installer.exe or the MS Windows ODBCConf.exe. It
- REM * may be safer to use the ODBCConf.exe when we think about such things
- REM * as 64bit windows.
- REM ****
- ECHO Registering driver
- myodbc-installer -d -a -n "MySQL ODBC 5.1 Driver" -t "DRIVER=myodbc5.dll;SETUP=myodbc5S.dll"
- ECHO "+-----------------------------------------------------+"
- ECHO "| DONE |"
- ECHO "+-----------------------------------------------------+"
- ECHO "| |"
- ECHO "| Hopefully things went well; the Connector/ODBC |"
- ECHO "| files have been copied to the system directory |"
- ECHO "| and the driver has been registered. |"
- ECHO "| |"
- ECHO "| Connector/ODBC is ready to use. |"
- ECHO "| |"
- ECHO "| The most common thing to do next is to go to the |"
- ECHO "| Control Panel and find the ODBC Administrator - |"
- ECHO "| then use it to create a Data Source Name (DSN) |"
- ECHO "| so you (and your application) can connect to a |"
- ECHO "| MySQL server. |"
- ECHO "| |"
- ECHO "+-----------------------------------------------------+"
- EXIT /B 0
- :doError2
- ECHO "+-----------------------------------------------------+"
- ECHO "| ERROR |"
- ECHO "+-----------------------------------------------------+"
- ECHO "| |"
- ECHO "| Connector/ODBC not built. |"
- ECHO "| |"
- ECHO "+-----------------------------------------------------+"
- PAUSE
- EXIT /B 1
- :doError4
- ECHO "+-----------------------------------------------------+"
- ECHO "| ERROR |"
- ECHO "+-----------------------------------------------------+"
- ECHO "| |"
- ECHO "| Existing Connector/ODBC installed. Request ignored. |"
- ECHO "| |"
- ECHO "+-----------------------------------------------------+"
- PAUSE
- EXIT /B 1
- :doError5
- ECHO "+-----------------------------------------------------+"
- ECHO "| ERROR |"
- ECHO "+-----------------------------------------------------+"
- ECHO "| |"
- ECHO "| Can't find the Windows system directory |"
- ECHO "| |"
- ECHO "+-----------------------------------------------------+"
- PAUSE
- EXIT /B 1
卸载部分
- @ECHO OFF
- REM #########################################################
- REM
- REM /brief Uninstall myodbc.
- REM
- REM This exists for those working with the Windows source
- REM distribution.
- REM
- REM Use this to remove the driver and supporting files
- REM from the system directory and deregister the driver.
- REM
- REM /sa README.win
- REM
- REM #########################################################
- SET installdir=none
- IF EXIST %windir%/system/nul SET installdir=%windir%/system
- IF EXIST %windir%/system32/nul SET installdir=%windir%/system32
- IF %installdir%==none GOTO :doError4
- IF NOT EXIST %installdir%/myodbc-installer.exe GOTO doError2
- REM ****
- REM * Deregistering driver...
- REM ****
- myodbc-installer -d -r -n "MySQL ODBC 5.1 Driver"
- REM ****
- REM * Removing files...
- REM ****
- del /Q /F %installdir%/myodbc5S.dll
- del /Q /F %installdir%/myodbc5S.lib
- del /Q /F %installdir%/myodbc5.dll
- del /Q /F %installdir%/myodbc5.lib
- del /Q /F %installdir%/myodbc-installer.exe
- del /Q /F %installdir%/myodbc3*.hlp
- ECHO "+-----------------------------------------------------+"
- ECHO "| DONE |"
- ECHO "+-----------------------------------------------------+"
- ECHO "| |"
- ECHO "| Hopefully things went well; the Connector/ODBC |"
- ECHO "| files have been removed from the system directory |"
- ECHO "| and the driver has been deregistered. |"
- ECHO "| |"
- ECHO "+-----------------------------------------------------+"
- EXIT /B 0
- :doError2
- ECHO "+-----------------------------------------------------+"
- ECHO "| ERROR |"
- ECHO "+-----------------------------------------------------+"
- ECHO "| |"
- ECHO "| Connector/ODBC does not appear to be installed. |"
- ECHO "| |"
- ECHO "+-----------------------------------------------------+"
- PAUSE
- EXIT /B 1
- :doError4
- ECHO "+-----------------------------------------------------+"
- ECHO "| ERROR |"
- ECHO "+-----------------------------------------------------+"
- ECHO "| |"
- ECHO "| Can't find the Windows system directory |"
- ECHO "| |"
- ECHO "+-----------------------------------------------------+"
- PAUSE
- EXIT /B 1
关键部分都带有注释,如有问题欢迎大家一起讨论。
同时附已经做好的mysql odbc 5.1 Driver免安装包
http://blog.csdn.net/blpluto/article/details/5677487
Mysql ODBC 5.1 Driver免安装脚本的更多相关文章
- MySQL ODBC 3.51 Driver - Access Denied
MySQL ODBC 3.51 Driver - Access Denied 同事反馈在应用服务器上配置MySQL ODBC 3.51 Drive时,测试连接MySQL数据库时报下面错误: ERR ...
- 【MYSQL】mysql-5.6.19-win32免安装版本配置方法
[MYSQL]mysql-5.6.19-win32免安装版本配置方法 1.文件下载网站(http://dev.mysql.com/downloads/): 具体下载地址:http://211.136. ...
- mysql 自动备份和nginx自动安装脚本
一.自动备份Mysql脚本: 如下脚本为mysql自动备份脚本,仅供参考,可以根据实际情况修改. #!/bin/sh #auto backup mysql #wugk #Define PATH定义变量 ...
- 新版本MySQL Server 5.7的免安装版本设置
今天重新配置电脑,安装java开发运行的相关环境,在安装mysql的过程中,遇到了一些问题. 因为在网站上下载的是免安装版本的mysql 5.7 ,所以在安装过程中只需要解压缩zip的压缩包即可. 之 ...
- Mysql在windows下的免安装配置步骤和重新安装的步骤
windows下mysql免安装配置 1. 下载mysql免安装压缩包 下载mysql-5.6.22-winx64.zip 解压到本地D:\mysql-5.6.22-winx64 2. 修改配置文件 ...
- Mysql 5.7 for windows 免安装版(解压版)安装和配置
网上写的不近详细,这里重新整理下. 准备: 1.windows操作系统 2.mysql 的解压版压缩文件 第一步: 解压mysql的压缩包到你的安装目录,因为是虚拟机,这里我就安装在C盘下:C:\my ...
- MySql 5.7.20版本免安装版配置过程
下载地址为: https://dev.mysql.com/downloads/mysql/ 最下面根据自己的操作系统选择合适的型号 下载完以后解压缩到自定义的路径.这里注意的是路径中不要存在中文. 解 ...
- MySQL Server 5.5.44免安装版配置详解
转载地址:http://wenku.baidu.com/view/2a8bfe6a25c52cc58bd6beff.html### 一 下载MySQL http://dev.mysql.com/dow ...
- windows下mysql免安装版配置(踩过的坑)简记
下载 从官网(https://dev.mysql.com/downloads/mysql/)下载 这里的免安装版本的,相对来说干净,但是需要自己来配置很多东西. 配置 首先是注册windows的服务. ...
随机推荐
- Eclispse 换主题、皮肤、配色,换黑色主题护眼
链接地址:http://jingyan.baidu.com/article/6c67b1d68c03be2787bb1ed6.html Eclipse写android代码时,默认的文本和框架都是白色, ...
- 高级UIKit-05(CoreData)
[day06_1_CoreDataPerson]:保存person对象到coreData数据库 保存大量数据时用CoreData保存到数据库,数据库会存在documents目录下 操作步骤: 1.创建 ...
- 【译】在ASP.NET中创建PDF-iTextSharp起步
原文 [译]在ASP.NET中创建PDF-iTextSharp起步 .Net framework 中自身并不包含可以和pdf打交道的方法.所以,当你需要你的ASP.Net Web应用程序中包含创建或与 ...
- ORACLE客户端乱码
sqlplus 打开CMD窗口,出现乱码情况的解决办法 C:\Documents and Settings>set NLS_LANG=american_america.AL32UTF8 C:\D ...
- 清华集训2014 day2 task3 矩阵变换
题目 算法 稳定婚姻系统(其实就是贪心) 一个方案不合法,当且仅当下面这种情况: 设第\(i\)行选了数字\(x\),如果第\(j\)行有一个\(x\)在第\(i\)行的\(x\)后面,并且第\(j\ ...
- hdu 2896 病毒侵袭 AC自动机 基础题
病毒侵袭 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
- maven本地jar
<dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId&g ...
- java中的object类
在Java中,任何一个类都扩展来自Object类.当没有为某一个类定义父类时,Java会自动定义Object类为其父类. object类的一些常用方法: (1)public String toStri ...
- WCF技术剖析之十:调用WCF服务的客户端应该如何进行异常处理
原文:WCF技术剖析之十:调用WCF服务的客户端应该如何进行异常处理 在前面一片文章(服务代理不能得到及时关闭会有什么后果?)中,我们谈到及时关闭服务代理(Service Proxy)在一个高并发环境 ...
- C++ Primer学习笔记2--c++标准库中的 vector、string 和 bitset 类型
一.string #include <string> using std::string 初始化函数: string s1; 默认构造函数 s1 为空串 ...