• Resolved yhmblogger

    (@yhmblogger)


    I’ve tried to install WordPress on my website server, which seems to go fine until I get a standard database connection error.

    This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.

    I’m using an AWS RDS endpoint for the DB_HOST in the configuration, but the odd thing is that the code seems to always think that my DB_HOST is localhost regardless of what I put into wp-config.php. If you look into the source code for the database, it checks the DB_HOST when passing the error above, so it is definitely checking what the DB_HOST value is.

    Any thoughts?

    • This topic was modified 6 years, 7 months ago by yhmblogger.
    • This topic was modified 6 years, 7 months ago by yhmblogger.
Viewing 14 replies - 1 through 14 (of 14 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    What value did you put in for DB_HOST?

    Thread Starter yhmblogger

    (@yhmblogger)

    I put and AWS RDS endpoint, which looks something like this:
    “xxxxxx.xxxx.xxxx.rds.amazonaws.com”

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Just for fun, can you connect to the db via the command line using the parameters from wp-cofnig.php?

    mysql -u DB_USER -pDB_PASS -h DB_HOST DB_NAME

    where you copy/paste the actual values from the config file?

    Thread Starter yhmblogger

    (@yhmblogger)

    Yes I can.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Do you have the necessary mysql/php libraries installed?

    Thread Starter yhmblogger

    (@yhmblogger)

    Yes, I’m pretty sure but, to be clear, which libraries would be necessary?

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    on my CentOS system, it’s php-mysqlnd.

    Thread Starter yhmblogger

    (@yhmblogger)

    I’m using this server to communicate with an crud application as well, which operates as expected. I’m just trying to add WP to the same server, so it’s most likely configured correctly.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    So there’s a thought; do an NSLOOKUP on your DB_HOST. If it’s returning an IPV6 and IPV4 address, put the IPV4 address in wp-config.php as the host name.

    Thread Starter yhmblogger

    (@yhmblogger)

    I tried the IPV4 address. No luck. But now something interesting happened. I was testing trying putting in random strings in the DB_HOST variable and now the error output is showing one of those random strings from a while back. Is there some kind of cache that keeps this value? Its now updated to the real address, but it continues to show “stuff”.

    This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at stuff. This could mean your host’s database server is down.

    I’ve done a fresh install and its still pulling DB_HOST that seems to be cached.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Changes in wp-config.php should be instant. Are you using a load balancer in front of your site?

    Thread Starter yhmblogger

    (@yhmblogger)

    No load balancer. Single EC2 instance. RDS database with the security groups set up to allow access.

    Thread Starter yhmblogger

    (@yhmblogger)

    The RDS is not pulicly accessible, but the EC2 instance has access to the DB by way of the security group. But that doesn’t explain why the error is still showing stuff.

    • This reply was modified 6 years, 7 months ago by yhmblogger.
    Thread Starter yhmblogger

    (@yhmblogger)

    Problem solved. I know that wp-config.php is not cached, but something like that was happening and the only thing that could clear it was a reboot of my server. No other configuration changes required.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘WordPress always thinks DB_HOST is localhost’ is closed to new replies.