If you wait a minute or two do you still have the problem?
It sounds like one of the problems I had here
This is because you are logging in to system using SSH before MariaDB has had a chance to start, if you give it a minute or two more you won’t get this message.
When you logon using SSH you get a MOTD-like message from FreePBX and the database has to be up for it no to fail in this way…