This old error
Error: Database connection failed
It is possible that the database is overloaded or otherwise not running properly.
The site administrator should also check that the database details have been correctly specified in config.php
I have set up two servers, one web server and one mysql db server and i am getting the above error. I have set up 500 moodle servers before but i am pulling my hair out on this one. Any ideas? both servers are on the same network, both apache web servers work on both machines from the browser, have checked and checked again the connection details in the moddle config file.
Database is running and a migration of a current running mysql database has been restored, moodle code is in place and so is the moodle-data directory. If I try and telnet to server and port I get xp1.myhost' is not allowed to connect to this MySQL serverConnection closed by foreign host
xp1.myhost is not my hostname its something else so I suspect that this has something to do with it.
Telnet test to mysql must include the mysqlDB server port.
DB servers usually have restricted access via the mysql DB itself which defines users privl as well as login/passwords and host (ie, clients connecting to it).
Does the DB server have the mysql port blocked from outside access?
nmap -P0 -p 3306 IPorHostnameofDBserver
Would show 'open' if one can connect to the MySQL port on the DB server.
Using a client app (mysql) from the web server, attempt to connect to the DB server using credentials which are all powerful ... ie, root?
mysql -h IPorHostnameofDBServer -u root -p[password]
If you can connect, use 'mysql' and run this query:
select * from host;
Databases themselves could be restricted and allowing only access from localhost ... ie, not your web server.
If you can't connect remotely in either case ... nmap or mysql client, then you have to access the DB server directly. And through whatever interface you have there check the firewall for the DB port and also use whatever mysql client on the DB server to check out permissions for user/hosts, etc.
'spirit of sharing', Ken