1、安装MySQL
apt-get install mysql-server mysql-client
修改配置,监听所有
vim /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address =0.0.0.0
重启
/etc/init.d/mysql restart
建立数据库
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.19-0ubuntu0.16.04.1 (Ubuntu)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE USER 'freeswitch'@'%' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> create database sofia_internal;
Query OK, 1 row affected (0.00 sec)
mysql> create database freeswitch;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on sofia_internal.* to 'freeswitch'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on freeswitch.* to 'freeswitch'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql>
2、安装ODBC
apt-get install unixodbc-dev
下载mysql的ubuntu odbc驱动
https://dev.mysql.com/downloads/connector/odbc/
解压后,拷贝lib里面的.so到/usr/lib/x86_64-linux-gnu/odbc/
在解压的bin里面,执行
./myodbc-installer -d -a -n "MySQL ODBC 5.3 Unicode Driver" -t "DRIVER=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc5w.so;SETUP=/usr/lib/x86_64-linux-gnu/odbc/myodbc5S.so"
./myodbc-installer -d -a -n "MySQL ODBC 5.3 ANSI Driver" -t "DRIVER=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc5a.so;SETUP=/usr/lib/x86_64-linux-gnu/odbc/lmyodbc5S.so"
或直接在/etc/odbcinst.ini增加
[MySQL ODBC 5.3 Unicode Driver]
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc5w.so
SETUP=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc5S.so
UsageCount=1
[MySQL ODBC 5.3 ANSI Driver]
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc5a.so
SETUP=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc5S.so
UsageCount=1
您的支持,是我持续创作的动力!!!!
3、配置ODBC
vi /etc/odbc.ini加入
[freeswitch]
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc5w.so
DATABASE = freeswitch
DESCRIPTION = freeswitch core
SERVER = 127.0.0.1
UID = freeswitch
PASSWORD = 123456
PORT = 3306
SOCKET =
[sofia_internal]
Driver =/usr/lib/x86_64-linux-gnu/odbc/libmyodbc5w.so
DATABASE = sofia_internal
DESCRIPTION = sofia internal
SERVER = 127.0.0.1
UID = freeswitch
PASSWORD = 123456
PORT = 3306
SOCKET =
-
测试连接
isql -v freeswitch
6、指定数据库连接
修改conf\autoload_configs\switch.conf 中的core-db-dsn
<param name="core-db-dsn" value="odbc://freeswitch:freeswitch:123456"/>
conf/sip_profiles/internal.xml中
<param name="odbc-dsn" value="odbc://sofia_internal:freeswitch:123456"/>
说明:odbc://连接方式
freeswitch:数据库名
freeswitch:用户名
123456:密码
您的支持,是我持续创作的动力!!!!