Error "Cannot connect to the configuration database" when you connect to a Windows SharePoint websites or Central Administrator.
This problem occurs when you made some update on windows / install or uninstall of MS products. You may have tried IISreset or server reboot but nothing worked. So lets try below point
1) By looking at massage a school guy can say its unable to connect Sql Database. So first step is to check Sql services and try to start/restart and check.Refer Link for details.
Still that doesn’t work you can try below option
2) Try to reconfigure Sql
It may be Your configuration trying to connect to the DB via the wrong port. Ir may be incorrect configuration setting accounts and all. Or may be firewall rule blocking you. To resolve this you can do Configuration of DB by configuration wizard you can refer Link for details.
3) Again this didn’t worked you it means your services and configuration is correct lets use some commands to do it work refer Link.
4) Go to Sql management and give permission to account
5) Or go to SQL server configuration manager change service account and try again by restarting/starting Sql services and again make old account and retry.
Don't forget to run with elevated privileges!