CDR module won't install

I’m attempting to install the cdr module and am getting following error:

SQLSTATE[HY000]: General error: 145 Table ‘./asteriskcdrdb/cdr’ is marked as crashed and should be repaired
$confs = $pdo->query($sql, DB_FETCHMODE_ASSOC);
// If we didn’t throw an exception, we’re done.
} catch (\Exception $e) {
$sql = “ALTER TABLE $db_name.$db_table_name ADD $cf VARCHAR ( 80 ) NOT NULL default ‘’”;

any ideas?

mysql -u root asteriskcdrdb
repair table cdr

Short of the two step command, there might be a one-step command you can that I can never remember.

I ran the following command

mysqlcheck -u root -p asterisk --auto-repair -c -o

but no changes seem to be made. I then ran the following:

mysql -b -u root -D asteriskcdrdb -e “REPAIR TABLE cdr” -u root

[[email protected] ~]# mysql -b -u root -D asteriskcdrdb -e “REPAIR TABLE cdr” -u root -p asterisk
Enter password:
| Table | Op | Msg_type | Msg_text |
| asterisk.cdr | repair | Error | Table ‘asterisk.cdr’ doesn’t exist |
| asterisk.cdr | repair | status | Operation failed |

asteriskcdrdb (not asterisk) just like the error message said.

1 Like

I like:

mysqlcheck --repair --all-databases

My suite has a single database server for all of my installations, so I tend to be a little more surgical. For me, that --all-databases option would take hours.

On a typical system, however, yeah - go for it.

This did the trick:

mysqlcheck -u root -p asteriskcdrdb --auto-repair -c -o

thanks! - Now to see if my cdr will show calls. I’m guessing it won’t fill in old information from previous calls

Anything from before the database crash, whenever that was.