Mysql database hostname

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by skarecx1, Feb 2, 2012.

  1. skarecx1

    skarecx1 New Member

    Hello all

    please forgive if this is in the wrong category, but i think it should be ok.

    So, please have a look at the code below:

    " private function __construct()
    {
    $dsn = 'mysql.x10hosting.com://skarecx1_root:password@localhost/skarecx1_rss';
    $this->_handle =& DB::Connect( $dsn, array() );
    }
    "

    this function is pasted in a PHP file called rss_db, which is uploaded to the public_html folder. There's more code included in the file, but im not going to paste that here.

    I have also created a database called skarecx1_rss (just _rss basically, but by default it adds skarecx1.

    The database is skarecx1_rss the user is skarecx1_root. As i have two mysql databases running on skarecx1, i guess i need to specify that i want to use the _rss database after localhost?

    So to my problem, how am i suppose to put in my credentials in the code? Is there any kind of template im not aware of?

    i have tried with several different options, mysql://skarecx1_root:password@localhost_skarecx1_rss etc etc.. i cant get it to work.

    Someone got any inputs on this issue?

    Thanks in advance.
  2. nuwanpra

    nuwanpra New Member

    Normally this is the way you do this in your config.php file. Hope this will help.

    Code:
    // ** MySQL settings - You can get this info from your web host ** //
    
    /** The name of the database for WordPress */
    
    define('DB_NAME', 'your_DBNAME');
    
    
    /** MySQL database username */
    
    define('DB_USER', ''your_DBUSER');
    
    
    /** MySQL database password */
    
    define('DB_PASSWORD', ''your_DBPWD');
    
    
    /** MySQL hostname */
    
    define('DB_HOST', 'localhost');
  3. misson

    misson Community Paragon Community Support

    The MySQL connection information is outlined in an X10 wiki article. As for the appropriate DSN format, we can't say since you didn't specify what DB module you're using. In any case, check the documentation.

    nuwanpra, that's merely a convention employed by some packages, a convention skarecx1's code clearly doesn't follow.

Share This Page