WordPress.org

Ready to get started?Download WordPress

Forums

define('DB_HOST', 'localhost'); How do I change this? (7 posts)

  1. WhyNot
    Member
    Posted 7 years ago #

    Hi everyone,

    I have a weird problem. My blog has been running for years just fine, but as of 2 days ago, the account of the ISP on which it runs is blocked of access. I get a Error 403 Access denied message, and even if I try to get in there via FTP I'm denied access.

    On the other hand, I can still use my login/PW on the SQL site using phpmyadmin and I can see the 13 tables there.

    So, since I have other sites on the same ISP (and which don't have this blocked access problem, I thought I'd temporarily run my blog from one of them.

    I've FTP'd to my alternate site all the WP stuff (of which I have a copy on my HDD).

    Since my 'old' site's database is accessible, rather then export it and import it on the new site's database, I thought it was maybe possible to invoke the old site's database.

    This is where, while looking at the wp_config.php file I thought this might be possible, but maybe I am missing the boat completely.

    Is this define('DB_HOST', 'localhost'); line where you can specify that you want to access a database located elsewhere than the one assigned to the site by the ISP?

    And, if so, what is the syntax I should use in wp_config.php to tell it to go look for the old database?

    Do I make any sense, lol?

  2. MichaelH
    Member
    Posted 7 years ago #

    You can change 'localhost' to whatever the MySQL server/host is. In some cases it could be an IP address ('192.1.1.1'), in others it might be 'mysql.sample.com' or just 'mysql'.

    Sometimes in phpMyAdmin you can discern the MySQL server name in the right panel (usually near the top).

  3. WhyNot
    Member
    Posted 7 years ago #

    MichaelH,

    Thank you for replying. I've tried a few things but no luck so far. One of the problems is that both the new and old site are on the same ISP, so that the IP address is the same. I'm sorry, I am quite ignorant and am obviously tackling things that are beyond me.

    When logging on the ISP's "old" account and launching phpmyadmin I see at the top:

    Welcome to phpMyAdmin 2.6.3-pl1
    MySQL 5.0.37 running on sql.free.fr as dianne@172.20.244.3

    But then if I log out, log back in under the "new" account and fire phpmyadmin, I see exactly the same thing - as if the "new" site is pointing to the same database. And yet WP complains it can't get to it.

    It's probably me fiddling around not knowing what I am doing, because when I first used phpmyadmin on this "new" site there was no database at all - but now it shows the dianne one.

    From what I understand, each user on Free (the ISP) gets a http://username.free.fr/ site, and when you enable the PHP/SQL stuff it creates a database named after your username.

    Did I really screw everything up?

    I was wondering... if I could email you and give you the logins and passwords of both accounts, maybe you could take a look? I'll pay you - Paypal or whatever you prefer.

    I'm so upset with the blog being down, and since Free do not give any service on their hosting, the old account being blocked could go on being so forever (I managed to talk to someone after ringing Paris long distance about 50 times, and he took a look and said the account was NOT blocked, so as far as they are concerned there is no technical problem, even though he confirmed that he too was getting the 403 access denied error).

    If you were at all willing to help this way, here is my email address: whynot@elektric-kat.com

  4. MichaelH
    Member
    Posted 7 years ago #

    You DB_HOST would be 'sql.free.fr'.

  5. reneechung
    Member
    Posted 6 years ago #

    I'm having some problems as well. My blog url is http://blog.domain.com. The control panel told me specifically to put mysql5int.yourdomain.com as the host. I've tried but I'm still getting the error database connection. I've tried putting mysql, localhost, ip address, nothing works. Anyone has any idea?

    Thanks in advance.

  6. obscure
    Member
    Posted 6 years ago #

    reneechung - triple check that you haven't omitted the ' before and after the hostname, user name and password. Triple check there are no extra spaces before/after (' localhost' - like that). I am sure that you are 100% sure that you typed everything correctly but typo is the solution in 99.999999% of cases.

    If that doesn't solve it them contact your host to check that the host name listed in CP is still correct (those details sometimes go out of date and get missed).

  7. cobold0815
    Member
    Posted 6 years ago #

    I have the same problem with free.fr: I have the wordpress files on the server and the database is also there but I always get the "Error establishing a database connection"-message. I have

    // ** MySQL settings ** //
    define('DB_NAME', 'luedekem0815');    // The name of the database
    define('DB_USER', 'luedekem0815');     // Your MySQL username
    define('DB_PASSWORD', 'here_is_my_password'); // ...and password
    define('DB_HOST', 'sql.free.fr');    // 99% chance you won't need to change this value
    define('DB_CHARSET', 'utf8');
    define('DB_COLLATE', '');

    as settings and don't know what I am doing wrong. :(
    Thanks for any help in advance!
    Micha

Topic Closed

This topic has been closed to new replies.

About this Topic