WordPress.org

Ready to get started?Download WordPress

Forums

install.php cannot access DB in DMZ (3 posts)

  1. leeman
    Member
    Posted 3 months ago #

    I am getting the "Error establishing a database connection" when trying to install WordPress. I am trying to install using Firefox on my Win7 box on our LAN.
    I have a CentOS box in our DMZ with mysql installed. I have created a DB for WordPress and can access it from a CentOS box on my LAN. I can login, create tables, and insert data. However, I can't get the install.php to connect to the DB. I'm sure I have the correct DB name, username and password. For the database host, I've tried localhost as well as its IP address, 192.168.0.xx.
    Any help would be greatly appreciated.
    Thanks.
    LeeMan

  2. JustinLewisSMA
    Member
    Posted 3 months ago #

    I'm not sure I understand your setup.

    Are you planning on running WordPress on the CentOS box? If so, then using localhost as your DB_HOST is the right way to do it.

    If you're planning on running WordPress on your Win7 box, but with the database hosted on the CentOS box, then the IP Address is how you would do it. Likely the issue in this case is that there's some sort of firewall mechanism that's stopping outside connections to your database.

    Maybe something like this will work: http://www.rackspace.com/knowledge_center/article/installing-mysql-server-on-centos

  3. leeman
    Member
    Posted 3 months ago #

    Still stuck on this issue.
    Just to clarify, I am running the DB and WordPress on the same server in the DMZ. From my browser(FireFox on Win7) I can run intall.php, but it can't connect to the DB. From a linux box on our LAN, using mysql client, I can connect, create tables, insert data just fine. Also, I put a small php script on the DB server that connects to the DB. I can access that from my browser just fine. The php script I tested is below.
    Any suggestions?
    Thanks.
    LeeMan

    <html>
    <head><title>test</title></head>
    <body>
    <?php
    
    $link = mysql_connect('192.168.0.xx', 'wpadmin', 'goodPassword');
    if (!$link) {
        die('Not connected : ' . mysql_error());
    }
    
    // make foo the current db
    $db_selected = mysql_select_db('wpdb', $link);
    if (!$db_selected) {
        die ('Can\'t use wpdb : ' . mysql_error());
    }
    echo "Connected"
    ?>
    </body>
    </html>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

Reply

You must log in to post.

About this Topic

Tags

No tags yet.