Locked out, no PHP access, "unable to establish connection to database: (3 posts)

  1. rubytuesday
    Posted 6 years ago #


    I need some help and in a panic.

    What happened:
    1. I created a website at testdomain.com
    2. The company's computer/web guy moved it to domain.com, with permission and as planned
    3. I went into domain.com/wp-login.php and under settings changed URLs from testdomain.com to domain.com

    1. When I go to domain.com I get the error" unable to establish connection to database"
    2. domain.com/wp-login.php says the same.
    3. I can' get into PHP access on my hosting service.
    4. I can get into FTP access on my hosting service.

    Please someone help me!


  2. rubytuesday
    Posted 6 years ago #

    Will this work to fix the problem in reverse:

    OPTION 2. If you forget to change the WordPress Address and Blog Address, you will be unable to change it using the wordpress interface. However, you can fix it if you have access to the database. Go to the database of your blog and find the wp_options table. This table stores all the options that you can set in the interface. The WordPress Address and Blog Address are stored as siteurl and home (the option_name field). All you have to do is change the option_value field to the correct URL for the records with option_name=’siteurl‘ or option_name=’home‘.

    Suppose you accidentally changed the URIs where you cannot move the files. (but still can access the login page, through a redirection or something)

    wp-login.php can be used to (re-)set the URIs:

    //FIXME: do comment/remove these hack lines. (once the database is updated)
    update_option('siteurl', 'http://your.domain.name/the/path' );
    update_option('home', 'http://your.domain.name/the/path' );

    You're done. Test your site to make sure that it works right. If the change involves a new address for your blog, make sure you let people know the new address, and consider adding some redirection instructions in your .htaccess file to guide visitors to the new location.

    Changing The Site URL also provides the details of this process!

    Where do I add the code to the wp-login.php?

  3. James Huff
    Support Representative
    Posted 6 years ago #

    When I go to domain.com I get the error" unable to establish connection to database"

    That error is correct 99.9% of the time. Contact your hosting provider and confirm that your connection details in the wp-config.php file are correct. Most of the time, either the DB_HOST was set incorrectly or the database server is offline.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.