Repairing Asterisk MySql

Posted: November 15, 2013 by gngtech in Uncategorized

It’s 7 PM and your wife calls telling you the phones are acting up. Your mind starts racing going through everything you’ve dealt with in the past. Usually its easy to attribute the phones not working to something you recently messed with when you really shouldn’t have. But every once in a while it is something else entirely, maybe even something you had no control over. This so happened to us when our Trixbox server decided to corrupt one of its MySql tables, leading to all sorts of problems.

In our case visiting the Trixbox home page didn’t reveal something obvious. It was only when we tried navigating to any of our extensions to view the details that we really saw any indication of a problem. We were introduced to a poorly formatted page with SELECT statements and the ever ominous statement “Table ‘./asterisk/extensions’ is marked as crashed.” Crashed sounds like a really bad thing to happen to our extensions table. We weren’t going to let this get us down; we were going to fix this. If this happens to you, these steps may help:

1) SSH to your * box.

2) Run “mysql -u root -p”.

3) The default password for the * MySql is “passw0rd”, sorry folks that 0 is a zero.

SSH-MySql-CLI-Asterisk

4) Now pay attention to the error message because it tells you the database and table that is “crashed.” In our case it’s the asterisk database and extensions table.

5) Type “use asterisk;”. This command will switch the context of MySql to the asterisk database.

SSH-MySql-CLI-Asterisk-2

6) Type “repair table extensions;”. This command will perform the repair.

SSH-MySql-CLI-Asterisk-3

7) Type “select * from extensions;”. This will select from the table and verify the repair was effective.

8) Go try opening the extensions in the web interface.

You should be all set!

For more information on the REPAIR TABLE command take a gander over at the MySql documentation: http://dev.mysql.com/doc/refman/5.0/en/repair-table.html.

Thanks for reading.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s