WordPress.org

Ready to get started?Download WordPress

Forums

localhost does not work, host supplies "simple script" (3 posts)

  1. silsurf
    Member
    Posted 7 years ago #

    I have installed WP onto my server. I have created and started a new MySQL DB. I tried to modified the wp-config.php using "localhost", but the install.php could not find the running db. I called the hosting service and they said I cannot use "localhost", but have to use a "simple connection script" instead. They emailed me the script, which is below. they also said I could try using the IP address to the db, which I did, but that did not take either.

    I do not understand how to impliment this "simple connection script"it into the wp-config.php file so the install.php will be able to connect to the bd. s

    Thanks for any guidance.

    Henry

    Simple Connection for MySQL Database
    $strDB=mysql_connect("205.178.146.15","username","password");

$database=mysql_select_db("db_name",$strDB);
     
     
    If a customer states that they can not connect to their MySQL Database and are receiving an error similar to the following:

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /data/1/0/0/00/123/user/555/htdocs/file.php on line 86

Check that they are not using "localhost" and instead are using the MySQL IP Address.

CORRECT!
mysql_connect("XXX.XXX.XXX.XX","username","password"); 
mysql_select_db ("database");

-----------------------------------------

INCORRECT!
mysql_connect("localhost","username","password"); 
mysql_select_db ("database");

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    All you need is right there.

    $strDB=mysql_connect("205.178.146.15","username","password");
    $database=mysql_select_db("db_name",$strDB);

    translates to:
    define('DB_NAME', 'db_name');
    define('DB_USER', 'username');
    define('DB_PASSWORD', 'password');
    define('DB_HOST', '205.178.146.15');

  3. silsurf
    Member
    Posted 7 years ago #

    Thanks, as it turns out the hosting service sent me the wrong IP address?#$%&

    I appreciate your fast response, I am all set.

Topic Closed

This topic has been closed to new replies.

About this Topic