Running trixbox databases on a different server

Having recently set up Asterisk, I was a little unhappy about the default installation of a MySQL server on the trixbox server and creating the databases there.

I have a separate MySQL server (with phpMyAdmin) and I didn’t want to have to think about backing up and maintaining another one, so I did a bit of Googling to find out how to migrate FreePBX or trixbox databases to another server.

The results were a little disappointing, with only vague references about how to go about doing it, and they seem to discourage it. Boring!

Here is what I did:

From what I can see, there are five databases that trixbox uses:

  • asterisk
  • asteriskcdrdb
  • asteriskrealtime
  • meetme
  • endpoints

A quick mysqldump will take care of these:

mysqldump -p -uroot --database asterisk \

asteriskcdrdb asteriskrealtime meetme \
endpoints > backup.sql

You will be asked for your trixbox MySQL root password (default is passw0rd).

Then copy the resulting SQL dump file to the database server:

scp backup.sql user@mysqlserver:

And stop MySQL on the trixbox server:

/etc/init.d/mysqld stop

Prevent it restarting:

chkconfig --level 345 mysqld off

Then change all references to localhost or 127.0.0.1 in the following files to point at your MySQL server. If you haven't already changed the default password for asteriskuser, then choose one now and edit is as well:

  • /etc/amportal.conf (references asterisk database)
  • /etc/asterisk/cdr_mysql.conf (references asteriskcdrdb database)
  • /etc/asterisk/res_mysql.conf (references asteriskrealtime database)
  • /etc/asterisk/cbmysql.conf (references meetme database)

The eagle-eyed will notice that I haven't changed the reference to the endpoints database. I don't use this and I can't find a reference to it. Can you?!?

Now on the MySQL server:

mysql -p -uroot < backup.sql

You will be asked for your MySQL root password.

Then pop into phpMyAdmin and create the asteriskuser user with the same password as was used on the trixbox server (I had already changed this from the default and updated the above conf files). Do not assign any default privileges.

Once the user is created, assign ALL PRIVILEGES (i.e. Check all except Grant) to the five databases listed above using the Database-specific privileges box.

All that remains is to restart Asterisk on the trixbox server and you are done.

/etc/init.d/asterisk restart

I hope that this helps you. Please leave feedback using the comments.

Advertisement
This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

2 Responses to Running trixbox databases on a different server

  1. AnRkey says:

    Thanks, this helped change my passwords on my trixbox from the default ones to more secure ones. I am also keeping this in my hat for another day :P

    R

  2. Thanks! I missed /etc/amportal.conf

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 )

Connecting to %s