I cannot connect to MySQL server, but I still can open it via PHP Admin

I am experiencing an issue while trying to use MySQL with my new WordPress site. I have correctly entered the database information, with the exception of modifying the password. However, I am receiving the error message “Error establishing a database connection”. The specific error is “php_network_getaddresses: getaddrinfo failed: Name or service not known”.


/** The name of the database for WordPress */
define( ‘DB_NAME’, ‘if0_35764957_pttools’ );

/** Database username */
define( ‘DB_USER’, ‘if0_35764957’ );

/** Database password */
define( ‘DB_PASSWORD’, ‘HIDDEN BY MOD’ );

/** Database hostname */
define( ‘DB_HOST’, ‘sql204.infinityfree.com’ );

/** Database charset to use in creating database tables. */
define( ‘DB_CHARSET’, ‘utf8’ );

/** The database collate type. Don’t change this if in doubt. */
define( ‘DB_COLLATE’, ‘’ );


Then I attempted to test the connection using the website → MySQL Connection Test
and received the following feedback:
“There are 3 connection steps to this tool - contacting the server, accepting the credentials, and accessing the specific database. This connection failed immediately because it was not able to find MySQL hostname. Please ensure that the ‘Server:’ value is entered correctly in the form to the left.”

Has anyone else encountered this issue and found a solution? I created my account approximately 12 hours ago, so I’m wondering if I need to wait for 72 hours for it to be resolved. If that’s the case, why am I still able to access it via PHP Admin from the dashboard? Thank you for any assistance.
Thank you all.

These tools won’t work here, as external connections are not allowed in free hosting:

I am assuming you are getting this issue on a WordPress installation hosted on InfinityFree (and not in, let’s say, a local environment)?

Would it be possible to share your wp-config.php database configuration (the ones you shared above) formatted with three backticks at the beginning and end:

/* your code here */

I’m asking this because the forum applies its own formatting when your code isn’t posted in this format, which can make identifying a potential issue harder.

10 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.