mysql的odbc驱动安装
时间: 2023-10-12 10:04:16 浏览: 201
mysql的odbc驱动程序
5星 · 资源好评率100%
要安装MySQL的ODBC驱动,可以按照以下步骤进行操作:
1. 在线安装驱动:
使用yum命令安装unixODBC和mysql-connector-odbc驱动:
```
# yum -y install unixODBC
# yum -y install mysql-connector-odbc
```
2. 注册驱动:
创建一个符号链接,将libmyodbc5a.so文件链接到/usr/lib目录下:
```
# ln -s /usr/local/mysql-connector-odbc-5.3.9/lib/libmyodbc5a.so /usr/lib/libmyodbc5a.so
```
使用myodbc-installer命令注册驱动:
```
# /usr/local/mysql-connector-odbc-5.3.9/bin/myodbc-installer -d -a -n "MySQL ODBC 5.3.9 Driver" -t "DRIVER=/usr/lib/libmyodbc5a.so;SETUP=/usr/lib/libmyodbc5a.so"
```
3. 配置驱动:
编辑odbc.ini文件,添加MySQL驱动的配置信息:
```
# vim /usr/local/etc/odbc.ini
```
在文件中添加如下信息:
```ini
[mysql-hr]
Driver = /usr/lib64/libmyodbc5.so
Description = MyODBC 5 Driver
SERVER = 192.168.235.140
PORT = 3306
USER = root
Password = root
Database = hr
OPTION = 3
charset=UTF8
```
4. 测试连接:
完成上述配置后,你可以使用ODBC连接来测试连接是否成功。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [MySQL ODBC 驱动安装](https://blog.csdn.net/weixin_34367845/article/details/94525747)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文