一、安装odbc
apt-get install unixodbc
如果需要用到编译的头文件之类的
apt-get install unixodbc-dev
二、安装mysql驱动
apt-get install libmyodbc
多数可能出现这个报错:
Reading package lists... Done Building dependency tree Reading state information... Done Package libmyodbc is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'libmyodbc' has no installation candidate
三、手动下载安装驱动
驱动下载地址:
https://dev.mysql.com/downloads/connector/odbc/
选择合适的版本和驱动
解压后,将库文件拷贝到合适的目录。
四、配置mysql驱动信息
文件:/etc/odbcinst.ini
[MySQL] Description=ODBC for MySQL Driver=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc5a.so //步骤3拷贝的路径 Setup=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc5S.so FileUsage=1
五、配置需要访问的数据库信息
文件:/etc/odbc.ini
1 [freeswitch] 2 Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc5a.so3 SERVER = localhost 4 PORT = 3306 5 DATABASE = freeswitch 6 OPTION = 67108864 //这个配置是支持多线程?对于freeswitch访问来说很重要! 7 USER = root 8 PASSWORD = password
六、测试驱动
isql -v freeswitch //先去数据库里创建一个表freeswitch
如果一切正常,能进入mysql后台。
反之,根据提示完善系统。