FreePBX access denied to SQL error on one node

Configuring synchronization, sensors, and optimizations
Post Reply
User avatar
CRM User
Posts: 151
Joined: Sun Nov 27, 2016 3:41 pm

FreePBX access denied to SQL error on one node

Post by CRM User » Tue Apr 09, 2019 5:54 pm

On one of my HAAst nodes I am getting this FreePBX error:

Code: Select all

Exception: SQLSTATE[HY000] [1045] Access denied for user 'freepbxuser'@'localhost' (using password: YES)::SQLSTATE[HY000] [1045] Access denied for user 'freepbxuser'@'localhost' (using password: YES) in file /var/www/html/admin/libraries/utility.functions.php on line 204
Stack trace:
  1. Exception->() /var/www/html/admin/libraries/utility.functions.php:204
  2. die_freepbx() /var/www/html/admin/libraries/BMO/Database.class.php:142
  3. PDOException->() /var/www/html/admin/libraries/BMO/Database.class.php:137
  4. PDO->__construct() /var/www/html/admin/libraries/BMO/Database.class.php:137
  5. FreePBX\Database->__construct() /var/www/html/admin/libraries/BMO/FreePBX.class.php:71
  6. FreePBX->__construct() /var/www/html/admin/bootstrap.php:153
  7. require_once() /etc/freepbx.conf:11
  8. include_once() /var/lib/asterisk/bin/fwconsole:12
Exception: SQLSTATE[HY000] [1045] Access denied for user 'freepbxuser'@'localhost' (using password: YES)::SQLSTATE[HY000] [1045] Access denied for user 'freepbxuser'@'localhost' (using password: YES) in file /var/www/html/admin/libraries/utility.functions.php on line 204
This is a new installation, and everything was working great for a few weeks. I tweaked some settings in FreePBX recently and then something broke. What did I do wrong and how do I fit it? Is HAAst malfunctioning?
Account for questions transferred from CRM system
User avatar
Telium Support
Posts: 202
Joined: Sun Nov 27, 2016 3:27 pm

Re: FreePBX access denied to SQL error on one node

Post by Telium Support » Tue Apr 09, 2019 6:03 pm

The problem most likely was created by changing the FreePBX database username/password on one node and not the other. Changing the FreePBX database username/password does two things: 1. it updates the /etc/freepbx.conf file, and 2. it updates the 'users' table in the MySQL 'mysql' database.

So although you may be syncing the 'freepbx' database between nodes, you are not syncing the 'mysql' database between nodes. And you should not try to synchronize the MySQL 'mysql' database (which holds the schema as well as user info), unless you are a DBA and really understand what you are doing!

The solution to this problem is very simple:
  • Copy the full MySQL database from the working node to the problem node; or,
  • Reset the FreePBX user password on the problem node to match the working node; or,
  • Don’t sync the freepbx.conf file and set the two nodes to have different passwords
To avoid this in the future either:
  • set the FreePBX MySQL user password identically on both systems; or
  • leave the default password; or
  • don’t synchronize the freepbx.conf file; or,
  • sync the ‘mysql’ database (but you have to be sure you understand the implications before doing so) – we don’t recommend this
So the cause and solution to this problem reside completely within FreePBX (HAAst has not malfunctioned in any way).
Post Reply