I have installed asterisk version 1.2.14, asterisk-addons 1.2.5 and mysql version 4.1.21. on Red Hat linux version 9.0. I created the database ‘asterisk’ in mysql so that the asterisk cdr record can be stored in my sql. I has edited the asterisk modules.conf to load cdr_addon_mysql.so and also change the configuration in cdr_mysql.conf. Finally, i do a reset on asterisk.
I got the below error message after i reset my asterisk.
Error [6825]: cdr_addon_mysql.c:231 mysql_log: cdr_mysql:cannot connect to database
ERROR[6969]: res_config_mysql.c: 651 mysql_reconnect: MYSQL RealTime: Failed to connect database server asterisk on (err 1045). Check debug for more info.
Do you have any solution on how to solve the above error message. Please Help !
now that the DB is created, with the username and passwd specified in cdr_mysql.conf ,do in mysql:
grant all privileges on asteriskdb.* to username@localhost identified by ‘passwd’;
grant all privileges on asteriskdb.* to username@127.0.0.1 identified by ‘passwd’;
flush privileges;
or whatever you think is the correct prvileges(read, write, update,…)
also, if you enable debugging messages to the cli, (in logger.conf uncomment the correct line), then with asterisk -rvvvvvvvvvddddddddddddd, do a ‘reload cdr_addon_mysql.so’ then you will get more output
Below is how I created the asteriskcdrdb database;
In the console, I type the following command;
a) cd /usr/local/mysql/bin
b) ./mysql --user=root --password=password -h dbhost
c) Mysql > CREATE DATABASE asteriskcdrdb;
d) Mysql > GRANT ALL PRIVILEGES
-> ON asteriskcdrdb.*
-> TO asterisk@localhost;
e) Mysql > use asteriskcdrdb;
f) Mysql > CREATE TABLE cdr (
-> calldate datetime NOT NULL default ‘0000-00-00 00:00:00’,
-> clid varchar(80) NOT NULL default ‘’,
-> src varchar(80) NOT NULL default ‘’,
-> dst varchar(80) NOT NULL default ‘’,
-> dcontext varchar(80) NOT NULL default ‘’,
-> channel varchar(80) NOT NULL default ‘’,
-> dstchannel varchar(80) NOT NULL default ‘’,
-> lastapp varchar(80) NOT NULL default ‘’,
-> lastdata varchar(80) NOT NULL default ‘’,
-> duration int(11) NOT NULL default ‘0’,
-> billsec int(11) NOT NULL default ‘0’,
-> disposition varchar(45) NOT NULL default ‘’,
-> amaflags int(11) NOT NULL default ‘0’,
-> accountcode varchar(20) NOT NULL default ‘’,
-> userfield varchar(255) NOT NULL default ‘’
-> );
Asterisk side
a) Copy cdr_addon_mysql.so into /usr/lib/asterisk/modules/
b) Edit /etc/sterisk/cdr_mysql.conf and add the following lines:
Does the MySQL database acknowldge the user “Asterisk” as a valid user account?
: O )
I see you have a database and your using root as the account to create that… but nowhere do I see you creating the user account along with the privliages invovled.