[unixODBC][MySQL][ODBC 8.0(a) Driver]Access denied for user

Command:

sudo asterisk -rvvvv

Output:

How to fix this? Please Help. Thanks.

With Hope,
Prabhakaran

P.S: Work at Stake Because of this Error :frowning_face:

Sounds like a bad username and password on the server or in your config.

CREATE USER ‘user’@’%’ DENTIFIED WITH mysql_native_password BY ‘mypass’;
GRANT ALL ON asterisk.* TO ‘user’@’%’;
FLUSH PRIVILEGES;

test from asterisk server
mysql -u user -h db.ip -p

Testing the unixodbc connection.

isql -v cdr username password

±--------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
±--------------------------------------+
SQL> show databases;
±----------------------------------------------------------------+
| Database |
±----------------------------------------------------------------+
| cdr |
| information_schema |
| mysql |
| performance_schema |
| sys |
±----------------------------------------------------------------+
SQLRowCount returns 5
5 rows fetched

$ cat /etc/odbc.ini
[cdr]
Description = Asterisk CDR Server
Trace = Off
Tracefile = stderr
Driver = MySQL ODBC 8.0 Unicode Driver
Server = 1.2.3.4
PORT = 3306
DATABASE = cdr

$ cat /etc/odbcinst.ini
[MySQL ODBC 8.0 Unicode Driver]
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc8w.so
UsageCount=1

[MySQL ODBC 8.0 ANSI Driver]
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc8a.so
UsageCount=1

/etc/asterisk/cdr_adaptive_odbc.conf
[first]
connection=mysqlcdr
table=cdr

/etc/asterisk/res_odbc.conf
[asterisk]
enabled => no
dsn => asterisk
pre-connect => yes

[mysqlcdr]
enabled => yes
dsn=> cdr
username => cdr_insert
password => password
pre-connect => yes
max_connections => 5

ivr01*CLI> odbc show mysqlcdr

ODBC DSN Settings

Name: mysqlcdr
DSN: cdr
Number of active connections: 1 (out of 5)
Logging: Disabled

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.