Cannot restore backup to new machine - freepbx is same version

Considering the number of times I have built a new asterisk/fpbx box and moved config over using backup and restore, I’m feeling like an idiot. My ‘old’ box is Asterisk 1.8 w/fpbx 12.0.76. My ‘new’ box is 6.12.65 (also 12.0.76) All the freepbx modules are updated and match between the machines. I did a full backup and restored (selecting all) to the new box. First, I don’t get the red ''apply config" button after the restore which I think I should get. So if I go into another application, like extensions (and I see all my extensions there correctly), then I get the red button, and when I click it, I get this:

exit: 1
[FATAL] SQLSTATE[28000] [1045] Access denied for user ‘asteriskuser’@‘localhost’ (using password: YES) SQLSTATE[28000] [1045] Access denied for user ‘asteriskuser’@‘localhost’ (using password: YES)

Trace Back:

/var/www/html/admin/libraries/BMO/Database.class.php:70 PDO->__construct()
[0]: mysql:host=localhost;port=3306;dbname=asteriskcdrdb
[1]: asteriskuser
[2]: amp109

/var/www/html/admin/modules/cdr/Cdr.class.php:35 Database->__construct()
[0]: mysql:host=localhost;port=3306;dbname=asteriskcdrdb
[1]: asteriskuser
[2]: amp109

I’ve restored from a backup and tried this twice in case I missed something obvious - same result.

I’m not thinking this is strictly a password issue - the .conf files seem to have the same default passwords which I have never changed (amp111, amp109).

I really think I am doing something very straightforward that I believe I have done several times. I know freepbx has become more complex - is this approach no longer the correct way to move a config?

Help, guys!

Assuming mysqld is running, it looks like the restore process is overwriting the file:

You need to ensure the mysql credentials are set properly there

I think that moved me in the right direction. Here is what I discovered: On the old machine, freepbx.conf shows this:

$amp_conf[‘AMPDBUSER’] = “asteriskuser”;
$amp_conf[‘AMPDBPASS’] = “amp109”;

but in the new box, both before and after the restore, I see this:

$amp_conf[‘AMPDBUSER’] = ‘freepbxuser’;
$amp_conf[‘AMPDBPASS’] = ‘11c0aef52faf’;

so it looks pretty clear that the authentication is different. I tried to do a restore, then change freepbx.conf to asteriskuser/amp109 but that threw other errors.

I would conclude that the new build sets up different authentication than the older build. But when restoring, which one wins? Does the old database come over with its old password and with config files that identify that particular password? Or (apparently) does the restore simply import records into the new database using the new authentication even if some of those records contain config information for user/passwords that do not match that new authentication? If this is the case, I would think that somewhere in the database I could find the old password information and update it. Am I on the right track?

I’m still wondering why I hit this error - I think what I am doing is pretty typical. Somebody, please provide some guidance? Thanks.

In Settings, Advanced Settings, scroll to the CDR database section and remove all the values populating these fields.

A really horrible solution would be to add the asteriskuser with a password of amp109 to the new database. Give it the same privs as the freepbxuser and off you go.

Well I have a solution, although not a very simple one. Yes, the new database has different authentication and the config (asteriskdb) is carrying the old credentials so there is the mismatch. I could not find anything for CDR in settings->advanced settings so that took me nowhere.

I had been using phpmyadmin on my old box but that is evidently not a module anymore so I had to go barebones mysql here. I accessed ‘asterisk’ DB and changed the old user/password to that which was in the freepbx.conf.

Restart amportal and we’re back. I went through this a second time and ‘restored’ the phpmyadmin module from the backup. A little monkeying around with the passwords in the file and I am now able to use it again.

This version throws a lot of errors when restarting amportal. XMPP missing, prosody errors. These are things I don;t need but there seems to be no way to remove them? I’d like a clean startup/shutdown - too many years as a developer to be comfortable with unknown linkages and errors.

Thanks for the suggestions - other than being pretty shaky on amportal errors, I’m moving along. Now to run the fpbx 12 to 13 tool.