• For the past couple of months I have been creating a WordPress site locally using MAMP, Dropbox, and a remote database. This is the guide that I followed: https://chipcullen.com/developing-a-wordpress-site-locally-on-more-than-one-computer/

    I’ve spent all today trying to migrate the site from Dropbox to the server but I’m getting a database error when visiting the site. The steps that I’ve taken when migrating the site are:

    1. Changed the WordPress Home and Site URL in WordPress admin from localhost to the my domain.
    2. Double checked that the information in wp-config.php points to the database on the server. Note that the file had already been configured for the server because I was using the database remotely during local development.
    3. In phpmyadmin on the server, I’ve updated the siteurl and home values in wp_options from localhost:8888 to my domain URL.
    4. Through FTP, uploaded all WordPress files except .htaccess inside of the public_html directory on the server.

    All I get when visiting the site is “Error stabling a database connection”. I get the same error when attempting to login to WordPress with wp-login.php or wp-admin. What seems strange though is that the site still functions just fine locally even after the changes have been made in wp_options on the server.

    I’m at a loss of ideas on what to try. Does anyone see anything that I could have missed? Any help would be greatly appreciated. Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The only thing that stands out in your steps is this:

    Note that the file had already been configured for the server because I was using the database remotely during local development.

    Some hosts only allow certain URL’s to access the database servers, and sometimes their own hosting servers URL or IP address isn’t in the allowed list, so you need to use localhost or 127.0.0.1 instead.

    If that’s not the case the best thing you can do is ask your hosting company to verify the details as they should be able to tell if there’s anything wrong with them fairly easily.

    Dion

    (@diondesigns)

    It’s also possible that the DB user only has remote access, and the server firewall is blocking port 3306.

    Thread Starter juiceboxdev

    (@juiceboxdev)

    so you need to use localhost or 127.0.0.1 instead.

    This was the issue. Changing the DB_HOST to localhost did the trick. Thank you both for your help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Database Error’ is closed to new replies.