WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] trouble installing WP - can't connect to database (20 posts)

  1. graywave
    Member
    Posted 9 years ago #

    I'm trying to set up WP on http://www.nsiweblog.com, with hosting provided by Expert Host. I copied the files into the /www directory, and created a database. The database seems to be hosted at sql10.webminder.com, but WP won't connect to it when I try to install. Localhost don't work.

    I know that similar topics have been covered before, but it just won't work for me, no matter what combinations of host names I try.

    Here is my original wp-config.php code:
    code
    <?php
    // ** MySQL settings ** //
    define('DB_NAME', 'wordpressblog'); // The name of the database
    define('DB_USER', 'wordpress'); // Your MySQL username
    define('DB_PASSWORD', '******'); // ...and password
    define('DB_HOST', 'http://sql10.webminders.com'); // 99% chance you won't need to change this value

    // Change the prefix if you want to have multiple blogs in a single database.
    $table_prefix = 'wp_'; // example: 'wp_' or 'b2' or 'mylogin_'

    // Change this to localize WordPress. A corresponding MO file for the
    // chosen language must be installed to wp-includes/languages.
    // For example, install de.mo to wp-includes/languages and set WPLANG to 'de'
    // to enable German language support.
    define ('WPLANG', '');

    /* Stop editing */

    define('ABSPATH', dirname(__FILE__).'/');
    require_once(ABSPATH.'wp-settings.php');
    ?>
    /code

  2. Jinsan
    Member
    Posted 9 years ago #

    try setting localhost as your db_host:

    <?php
    // ** MySQL settings ** //
    define('DB_NAME', 'accountusername_dbname'); // The name of the database
    define('DB_USER', 'accountname_dbusername'); // Your MySQL username
    define('DB_PASSWORD', 'your database pass'); // ...and password
    define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value

    so your db name will be the account username you use to login to your host account, bob or fred for example and then the name of the database, wordpress for example, so the result is:

    bob_wordpress

    your database username is the name used in the database, so it woul dbe account name and db username:

    bob_wpking where wpking is the username for the database.

  3. graywave
    Member
    Posted 9 years ago #

    No, I tried it again but it still doesn't work. I have tried it in so many combinations my head is spinning...

    Any other help??

    wp-config.php looks like this now:
    code
    <?php
    // ** MySQL settings ** //
    define('DB_NAME', 'wordpressblog'); // The name of the database
    define('DB_USER', 'wordpress'); // Your MySQL username
    define('DB_PASSWORD', '*****'); // ...and password
    define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value

    // Change the prefix if you want to have multiple blogs in a single database.
    $table_prefix = 'wp_'; // example: 'wp_' or 'b2' or 'mylogin_'

    // Change this to localize WordPress. A corresponding MO file for the
    // chosen language must be installed to wp-includes/languages.
    // For example, install de.mo to wp-includes/languages and set WPLANG to 'de'
    // to enable German language support.
    define ('WPLANG', '');

    /* Stop editing */

    define('ABSPATH', dirname(__FILE__).'/');
    require_once(ABSPATH.'wp-settings.php');
    ?>

  4. cameroon
    Member
    Posted 9 years ago #

    Is your version of PHP using the mysqli library? If it is not, and you are using MySQL 4.1, then you can't authenticate from PHP scripts.

    Your choices are to either downgrade MySQL to 4.0 or to recompile PHP and tell it to use mysqli instead of mysql.

    That was the situation here, when I did a complete reinstall of my system and decided that I wanted MySQL 4.1 for sub-selects. I'm back with 4.0 now though.

  5. moshu
    Member
    Posted 9 years ago #

    @graywave
    try it without the http:// - I mean like this:
    define('DB_HOST', 'sql10.webminders.com'); // // 99% chance you won't need to change this value

  6. graywave
    Member
    Posted 9 years ago #

    @cameroon
    My hosting provider says that it supports the following:

    * PHP Version 4.3.0
    * MySQL 3.23.54

    I don't know about the mysqli library.

    @moshu
    Thanks, but I already tried that. I think that I am going to try a different host.

    Anybody have experience with Cedant.com, SiteGround.com, or ICDSoft.com ?

  7. graywave
    Member
    Posted 9 years ago #

    Thank you all for trying to help!!

  8. gvandyk
    Member
    Posted 9 years ago #

    Try finding out if your hosting provider has SELinux installed.

    I had the same problem of not being able to connect to the database. I tried everything. Literally 4 hours of trying different combinations.

    I am using Fedora Core 3 which has SELinux enabled by default. I disabled SELinux in desperation, rebooted and hey wordpress works.

    I don't know how SELinux works so I will have to look into this to solve the problem properly.

    Hope this helps.

  9. farrokh
    Member
    Posted 9 years ago #

    I am having the same problem. My website is hosted by godaddy.com. they are using PHP version 4.3.11 and the database server they tell me is:
    mysql.secureserver.net
    funny thing is that Bob Parsons, the founder of godaddy, seems to be using the wordpress to power his blog, so I figure there's got to be a way for me to get this amazing wp up and running. Is there?

  10. Mark (podz)
    Support Maven
    Posted 9 years ago #

    farrokh - what exactly is your problem ?

  11. farrokh
    Member
    Posted 9 years ago #

    I get the "Error establishing a database connection" message when I point my browser to /wp-admin/install.php

    BTW, thanks for lightening fast response podz :)

  12. Mark (podz)
    Support Maven
    Posted 9 years ago #

    If I remember right, at godaddy:
    username & db name are the same
    pass - you set
    host is as you've specified.

    The Boss there does indeed blog .... double checked everything in your file ?

  13. farrokh
    Member
    Posted 9 years ago #

    There is only one database created in my website and it is "farrokh" and
    wp-config.php is as follows:

    <?php
    // ** MySQL settings ** //
    define('DB_NAME', 'farrokh'); // The name of the database
    define('DB_USER', 'farrokh'); // Your MySQL username
    define('DB_PASSWORD', '*****'); // ...and password
    define('DB_HOST', 'mysql.secureserver.net'); // 99% chance you won't need to change this value

    // Change the prefix if you want to have multiple blogs in a single database.
    $table_prefix = 'wp_'; // example: 'wp_' or 'b2' or 'mylogin_'

    // Change this to localize WordPress. A corresponding MO file for the
    // chosen language must be installed to wp-includes/languages.
    // For example, install de.mo to wp-includes/languages and set WPLANG to 'de'
    // to enable German language support.
    define ('WPLANG', '');

    /* Stop editing */

    define('ABSPATH', dirname(__FILE__).'/');
    require_once(ABSPATH.'wp-settings.php');
    ?>

  14. Mark (podz)
    Support Maven
    Posted 9 years ago #

    'mysql.secureserver.net'

    Isn't there meant to be a number somewhere there ?

  15. farrokh
    Member
    Posted 9 years ago #

    Actually, yes...
    'mysql39.secureserver.net'

    let me try it like that and see what happens.

  16. farrokh
    Member
    Posted 9 years ago #

    Now I get this:

    Error establishing a database connection
    This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at mysql39.secureserver.net .

  17. Mark (podz)
    Support Maven
    Posted 9 years ago #

    I would check again that your name / password really are correct - check your confirmation emails from Godaddy if you have any.

  18. farrokh
    Member
    Posted 9 years ago #

    Oh I have and I'm quite confident they are correct. on the same note, the tech guys at godaddy offered the following scripting . what do you think? shoud I try to somehow modify wp-config using that script and then try?

    <?php
    //Sample Database Connection Syntax for PHP and MySQL.

    //Connect To Database

    $hostname="mysql.secureserver.net";
    $username="your_dbusername";
    $password="your_dbpassword";
    $dbname="your_dbusername";
    $usertable="your_tablename";
    $yourfield = "your_field";

    mysql_connect($hostname,$username, $password) OR DIE ("<html><script language='JavaScript'</html>");
    mysql_select_db($dbname);

    # Check If Record Exists

    $query = "SELECT * FROM $usertable";

    $result = mysql_query($query);

    if($result)
    {
    while($row = mysql_fetch_array($result))
    {
    $name = $row["$yourfield"];
    echo "Name: ".$name."<br>";
    }
    }
    ?>

  19. farrokh
    Member
    Posted 9 years ago #

    Ok podz,

    Idon't know what happened. But without me changing anything it finally worked after many times of trying and connection with the mysql database was established!!

    But now the pandora's box has opened to a whole new slew of problems for which I'm going to surf other threads here.

    Thanks for all your efforts in trying to help me.

  20. graywave
    Member
    Posted 9 years ago #

    Sorry, should have put this in a long time ago, but I successfully set up WordPress using SiteGround.com hosting. So far I have been very pleased with them. Excellent deal.

Topic Closed

This topic has been closed to new replies.

About this Topic