1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Connecting WordPress to a remote database

Discussion in 'MySQL' started by qazu, Jan 13, 2008.

  1. #1
    Hi,

    Does anyone know how to connect a WordPress installation to a remote MySQL database? My host uses a separate database server so the code

    define('DB_HOST', 'localhost');

    in the wp-config.php file doesn't work. I've tried putting the url in place of 'localhost' as well as the IP address as in

    define('DB_HOST', 'http://db.domain.com:port');

    and

    define('DB_HOST', 'http://xxx.xxx.xxx.xxx:port');

    where xxx.xxx.xxx.xxx is the IP address.

    Both give me a Error connection to database message.

    Usingthe IP address without 'http://' as in

    define('DB_HOST', 'xxx.xxx.xxx.xxx:port');

    gives me a CGI Error - The specified CGI application misbehaved by not returning a complete set of HTTP headers.

    Any ideas?
     
    qazu, Jan 13, 2008 IP
  2. caban

    caban Peon

    Messages:
    41
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try define('DB_HOST', 'xxx.xxx.xxx.xxx:port') but without the port. It should default to the correct port, I would think.

    Also make sure the MySQL server allows remote hosts to connect with your credentials.
     
    caban, Jan 13, 2008 IP
    qazu likes this.
  3. boltok

    boltok Active Member

    Messages:
    257
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    78
    #3
    Yes, just using the IP address or the hostname (e.g. "my.example.org"), without any port or http part, would be enough for this.
     
    boltok, Jan 14, 2008 IP
    qazu likes this.
  4. qazu

    qazu Well-Known Member

    Messages:
    1,834
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    165
    #4
    Thanks for the input guys. I've changed the installation to WordPRess 2.3.1 and it works perfectly with
    define('DB_HOST', 'xxx.xxx.xxx.xxx:port');
    Code (markup):
    Looks like the problem was with WordPress 2.3.2 and not the database connection. :confused:
    Thanks for your help.
     
    qazu, Jan 14, 2008 IP
  5. gorgeous

    gorgeous Banned

    Messages:
    211
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    run your WordPRess 2.3.1, backup all files then delete old files from V.2.3.1 but keep only wp-config.php when you have done all, then upload all new files from V.2.3.2 it will work perfect and easeir to install plugin.

    "dont forget CHMOD some files" :D
     
    gorgeous, Jan 18, 2008 IP
  6. ZKC

    ZKC Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    plz tell me wordpress
     
    ZKC, Jan 26, 2008 IP
  7. HARRY256

    HARRY256 Well-Known Member

    Messages:
    1,401
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    155
    #7
    wordpress!!!!! hahahahaha
     
    HARRY256, Mar 23, 2009 IP
  8. magicg

    magicg Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Here is the Stepbystep Tip:

    http://install-climber.blogspot.com/2011/08/wordpress-mysql-database-remote.html

    Thanks!
     
    magicg, Aug 5, 2011 IP
  9. rdunton772

    rdunton772 Guest

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    That is one way to do it, but there is also a new program in beta called JSONData.com that will update the database in real-time while allowing you to embed it anywhere (like a youtube video)
     
    rdunton772, Jun 14, 2012 IP
  10. mediaguru

    mediaguru Peon

    Messages:
    219
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Where is the LIKE button?
     
    mediaguru, Jul 12, 2012 IP
  11. melaychie

    melaychie Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    it doesn't work on mine. i am using justhost remote mysql and never worked. :(
     
    melaychie, Jul 27, 2012 IP
  12. whrsstech

    whrsstech Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Well, when you try connecting to a remote database, make sure that your IP is white listed in the database server. Then only it will connect fine.
     
    whrsstech, Aug 15, 2012 IP