I have taken a free wordpress hosting at Infinityfree to test out recently. For some programming I need to access the Wordpress Mysql database. I tried with following connection parameters
Server=sql305-infinityfree-com; (replace hyphen with dots, board is not allowing to post links)
Database=if0_39209049_wp687;
UID=if0_39209049;
PWD=xxxxxxxxxx
But could not connect from PHP, saying host does not exist. I then tried to read about this in this forums and in a topic with same name as this one from 2024, it become clear that those are fictituous host names for purpose of PhpMyAdmin only and I need to look for connection parameters at wp-config.php. I looked there and got these:
define( âDB_NAMEâ, âif0_39209049_wp687â );
define( âDB_USERâ, â39209049_1â );
define( âDB_PASSWORDâ, âxxxxxxxxxâ );
define( âDB_HOSTâ, âsql305-byetcluster-comâ ); (replace hyphen with dots, board is not allowing to post links)
But in both situation getting error as : PHP Warning: mysqli_connect(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Where am I getting wrong and what to do to fix this.
Itâs not that we set the hostname to some funny phpMyAdmin-only values. Whatâs actually happening is that you simply cannot connect to our database servers outside of our hosting. Regardless of what hostname you use.
You are kind of right that these hostnames are âfictitiousâ. But then itâs not like thereâre two types of hostnames for one being fake and one being real â thereâre no ârealâ hostnames for what youâre thinking of.
Now if you are actually connecting from within the hosting then itâs weird to get the message of host doesnât exist because itâs unlikely, but anyways, the login info youâre using is created by Softaculous and can sometimes cause issues.
But again, this is for connections inside our hosting only. It doesnât apply if you are connecting from outside.
Are you running this on a Windows machine by any change? Connection timeout errors can happen on all environments, but I have not seen it before with this particular message. And all the results I see for it are either from Microsoft or from companies that use a lot of Microsoft software.
If so, it means youâre not running the site on our hosting, which is also why you cannot connect to the database.
To develop your website on your own computer, please just backup the database of your hosting account, setup a MySQL server on your own computer and run the backup from that. Any data changed there wonât affect your real website, but usually thatâs for the better.
Thank you for explaning, its clear now that I cannot connect to the free hosting database from outsideof hosting account
What I meant was while the host name from wp-config file (sql305-byetcluster-com) at least resolved to an IP, the one from Infinityfree control panel (sql305-infinityfree-com) has no DNS lookup. So i wrote that fictitious bit!
I was able to connect from within the site and it is running fine.
I needed to access the MySql DB from a different server to test out a bit of program to import-export data from the Wordpress backend. I have achieved my objective. Thank you, again.
"I was able to connect from within the âInfinityfreeâ site and it is running fine.
I needed to access the MySql DB from a different server to test out a bit of program to import-export data from the Wordpress backend. I have achieved my objective. Thank you, again."