• Resolved blanchardtech

    (@blanchardtech)


    Trying to install second wordpress site on server, first one is working fine. I created a different database with a different user. I granted the rights to the user. I verified the grants to the user. The wp-config.php is exactly the same as the one from the one that is working except for user, password, and database. This is on a Windows Server 2022 Datacenter. I configured IIS for the directory the same except obviously for the bindings, and yet I still get

    This either means that the username and password information in your wp-config.php file is incorrect or that contact with the database server at localhost could not be established. This could mean your host’s database server is down.

    • Are you sure you have the correct username and password?
    • Are you sure you have typed the correct hostname?
    • Are you sure the database server is running?

    The answers are Yes, Yes, and Yes, that last two are obviously correct because the other site is running perfectly. Any thoughts on what could possibly be causing this issue.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hank

    (@poku1010)

    You can try creating a PHP script to test if the database connection is working properly.

    Here’s the test script:

    <?php
    $mysqli = new mysqli('localhost', 'username', 'password', 'database');
    if ($mysqli->connect_error) {
        die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error);
    }
    echo 'Connection successful!';
    $mysqli->close();
    ?>
    
    Thread Starter blanchardtech

    (@blanchardtech)

    btwp.blanchardtech.com/wp-testdb.php

    Connection successful!

    ??

    Hank

    (@poku1010)

    The PHP connection script successfully connected to the database! This means that both the database itself and the connection credentials are correct. Next, we can focus on the configuration and environment of WordPress itself.

    Here are further suggestions:

    1. Enable WordPress Debug Mode:
      • In wp-config.php, add or modify the following settings:
        define('WP_DEBUG', true);
        define('WP_DEBUG_LOG', true);
        define('WP_DEBUG_DISPLAY', true);
      • This will generate a debug.log file in the wp-content directory, recording detailed error information.
      • Check the debug.log file for more clues about the error.
    2. Check the Database Table Prefix:
      • Ensure that the $table_prefix in wp-config.php matches the actual table prefix in the database.
      • If this is a fresh installation, confirm that the appropriate tables have been created in the database.
      • If the tables haven’t been created, you may need to re-run the WordPress installation process.
    3. Verify Hostname Resolution:
      • Even if you are using localhost, try changing DB_HOST in wp-config.php to 127.0.0.1.
      • Sometimes hostname resolution can cause issues.
    4. Check PHP Error Logs:
      • Review PHP error logs for more detailed error information.
      • The location of the error logs can be found in the error_log parameter in php.ini.
    5. Verify Database User Permissions:
      • Although the connection was successful, the user might lack specific permissions for certain operations.
      • Run the following commands in the database to ensure the user has all necessary permissions: GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost'; FLUSH PRIVILEGES;
    6. Re-run the Installation Process:
      • If possible, delete the wp-config.php file and revisit the site in the browser to see if you can restart the installation process.
    Thread Starter blanchardtech

    (@blanchardtech)

    After playing around with it a while, Step 1-5 all checked out. Unfortunately step 6 was the problem, I could not get to the installation process. I deleted everything in the WP Directories and copied everything from the working wp site except except for the contents directory to the new site, changed all the user/database related issues, and it resolved itself, so my best guess is something did not copy right the first time.

    Hank

    (@poku1010)

    Congratulations????

    I’m glad to hear that you identified and resolved the issue. If re-entering the installation process isn’t possible, it indeed suggests that some core WordPress files were missing.

    • This reply was modified 4 months ago by Hank.
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.