Results 1 to 3 of 3

Thread: Mysql database hostname

  1. #1
    skarecx1 is offline x10Hosting Member
    Join Date
    Jan 2012
    Posts
    1

    Mysql database hostname

    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. #2
    nuwanpra's Avatar
    nuwanpra is offline x10Hosting Member
    Join Date
    Jan 2010
    Location
    Colombo, Sri Lanka
    Posts
    45

    Lightbulb Re: Mysql database hostname

    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. #3
    misson is offline x10 Spammer
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,573

    Re: Mysql database hostname

    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.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Jon Skeet's and Eric Raymond's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

Similar Threads

  1. mysql database hostname
    By obamademocrats201258 in forum Free Hosting
    Replies: 1
    Last Post: 07-20-2011, 02:54 PM
  2. MySQL database hostname
    By richardmiller0547 in forum Free Hosting
    Replies: 1
    Last Post: 09-30-2010, 03:23 PM
  3. How to get mysql database hostname?
    By Rapala in forum Free Hosting
    Replies: 10
    Last Post: 05-13-2010, 10:53 AM
  4. MySQL, Database server hostname...
    By hatchetdown in forum Free Hosting
    Replies: 6
    Last Post: 03-13-2010, 03:07 PM
  5. MySQL Database hostname
    By Relemar in forum Free Hosting
    Replies: 4
    Last Post: 09-09-2007, 08:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
dedicated servers