Skip to content

Lightsail/Wordpress site mysteriously down and inaccessible

0

Hello,

I'm not sure what happened, but sometime in the past few weeks (around NYE I think) my website went offline. This is the error I'm receiving when I go to my site https://www.streetlevelrecords.com/

Warning: mysqli_real_connect(): (HY000/2002): Connection refused in /opt/bitnami/wordpress/wp-includes/class-wpdb.php on line 1982

And line 1982 says: mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );

I can't access the site via WP admin, but can via FTP. However, I am being denied access to a bunch of files/folders. I haven't done anything to the site or done any updates recently. I do have the plugins set to auto-update, but I'm not sure a plugin caused this issue. I changed the name of the plugin folder and it didn't help. I'm wondering if it got hacked somehow? IDK. I'm totally lost here and would be grateful for any advice.

I ran sudo /opt/bitnami/ctlscript.sh status and it says Cannot find any running daemon to contact. If it is running, make sure you are pointing to the right pid file (/var/run/gonit.pid)

asked a year ago289 views
1 Answer
0

Based on the error message you're receiving, it appears that your WordPress site is unable to establish a connection with the database. This could be due to several reasons:

  1. Database server issues: The MySQL/MariaDB service might have stopped running or crashed.

  2. Incorrect database credentials: The wp-config.php file might have incorrect database connection details.

  3. Resource constraints: Your Lightsail instance might be running out of resources, particularly memory, which can cause database connection issues.

  4. Potential security breach: While it's less likely, it's possible that unauthorized access has occurred, leading to configuration changes.

To troubleshoot this issue:

  1. Try to restart the MySQL service on your Lightsail instance. You can do this by SSHing into your instance and running the command: sudo /opt/bitnami/ctlscript.sh restart mysql

  2. Check if MySQL is running by using the command: sudo /opt/bitnami/ctlscript.sh status

  3. Verify the database credentials in your wp-config.php file and ensure they match the actual database settings.

  4. Monitor your instance's resource usage, particularly CPU and memory. If you're consistently running low on resources, consider upgrading to a larger Lightsail plan.

  5. Review your Apache and MySQL error logs for any suspicious activity or error messages that might provide more insight into the issue.

  6. If you suspect a security breach, change your database and WordPress admin passwords, and consider restoring from a recent backup if available.

If these steps don't resolve the issue, you may need to dig deeper into the logs or consider restoring from a backup if you have one available. It's also worth noting that auto-updates, while generally beneficial, can sometimes lead to compatibility issues or conflicts that might cause site downtime.
Sources
Wordpress website on Lightsail keeps dropping offline/unavailable | AWS re:Post
Error establishing a database connection - Lightsail and Wordpress | AWS re:Post

answered a year ago
EXPERT
reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.