Call History - SELECT command denied to user

I am working with a fresh install of FreePBX and am having trouble getting call history to display on any user panel or operator panel. I get the following error on FOP2:

SELECT command denied to user ‘’@‘localhost’ for table ‘cdr’
Thanks for any suggestions you can provide.


  • edited December 2019

    Make sure when you post that you specify the version you are using as that can help us troubleshoot better.

    This worked for me:
    Configure the file /var/www/html/fop2/config.php with the credentials to the Asterisk Database.
    I found the credentials to my system in the file: /etc/freepbx.conf
    Make sure the following line also exists in: /var/www/html/fop2/config.php
    $CDRDBTABLE = "asteriskcdrdb.cdr";
    After editing this, I restarted the service and all worked (you may also try a reboot)

  • Hi joshuamarius,
    Do you have any idea with integrate yeastar PBX? I faced no record when I tried to check call history, I know it is via plugin and FOP2 server will save AMI cdr event to local database and also I have change file /var/www/html/fop2/config.php to details as show in the photo, I still not able to get cdr, also it's none saved in database when I access mysql to check.

  • the database pruebacdr is created automatically when I configure plugin CDR to DataBase on fop2 manager, but the table cdr is not created automatically while other 3 tables created automatically and when I add contact on user profile, it added in visual_phonebook table, any idea for my problem?
    It's great appreciation if somebody would check this.

  • I'm sorry; I've only worked with FreePBX. Maybe the forum Admin can help you.

  • Just like milos said, you have to make sure you put database setting in your pbx into your fop2. in here whe you use freepbx you can find database setting (dbname, user, password) in the /etc/freepbx.conf and change fop2 database setting, you can find in the /var/www/html/fop2/config.php.

  • edited November 2020

    @bayyou This is not fixed yet on FOP2 v 2.31.29 after upgrade from FOP2 v 2.31.25 to v 2.31.29!
    This should not be an issue with DB settings in /var/www/html/fop2/config.php due to the fact, that the DB settings are programmatically and correctly fetched with this procedure in /var/www/html/fop2/config.php:
    if(function_exists('mysqli_connect')) {

        $db = new dbcon($DBHOST, $DBUSER, $DBPASS, $DBNAME, false, true, $FORCE_UTF8);
        if(!$db->is_connected()) {
            // Database connection details from amportal 
            if (is_readable("/etc/amportal.conf")) {
                $amp_conf = parse_amportal_conf("/etc/amportal.conf");
                $DBHOST = $amp_conf['AMPDBHOST'];
                $DBNAME = $amp_conf['AMPDBNAME'];
                $DBUSER = $amp_conf['AMPDBUSER'];
                $DBPASS = $amp_conf['AMPDBPASS'];
            } else if (is_readable("/etc/freepbx/freepbx.conf")) {
                $amp_conf = parse_amportal_conf("/etc/freepbx/freepbx.conf");
                $DBHOST = $amp_conf['AMPDBHOST'];
                $DBNAME = $amp_conf['AMPDBNAME'];
                $DBUSER = $amp_conf['AMPDBUSER'];
                $DBPASS = $amp_conf['AMPDBPASS'];
            } else if (is_readable("/etc/freepbx.conf")) {
                $amp_conf = parse_amportal_conf("/etc/freepbx.conf");
                $DBHOST = $amp_conf['AMPDBHOST'];
                $DBNAME = $amp_conf['AMPDBNAME'];
                $DBUSER = $amp_conf['AMPDBUSER'];
                $DBPASS = $amp_conf['AMPDBPASS'];
            } else if (is_readable("/etc/asterisk/snep/snep-features.conf")) {
                $DBHOST = 'localhost';
                $DBNAME = 'snep';
                $DBUSER = 'snep';
                $DBPASS = 'sneppass';
                $CDRDBTABLE = "snep.cdr";
            $db = new dbcon($DBHOST, $DBUSER, $DBPASS, $DBNAME, true, true, $FORCE_UTF8);

    So there is still a Bug in FOP2 not able to show "Call History".

  • edited November 2020

    Now after trying to reinstall "Call History" the plugin installer reports "Not compatible with this version".
    Call History not compatible with this version... Great, but no warning message before upgrading FOP2... damned.

    So we have to stick to FreePBX v14 and FOP2 2.31.25 until Call History is fixed and ready for new version of FreePBX v15.

  • Any update on this? We think we are in the same boat.

  • Has anyone been able to get this to work?

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file