Title: DB_HOST connection string Error
Last modified: August 18, 2016

---

# DB_HOST connection string Error

 *  [DonG](https://wordpress.org/support/users/dong/)
 * (@dong)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/db_host-connection-string-error/)
 * After creating the database and username with password in Cpanel I receive the
   following PHP connection string:
    $dbh=mysql_connect (“localhost”, “netbased_nblog”,“
   <PASSWORD HERE>”) or die (‘I cannot connect to the database because: ‘ . mysql_error());
   mysql_select_db (“netbased_nblog”); Using only ‘localhost’ resulted in a connection
   error when running wp-admin/install.php. Now it gets started but I receive this
   error” Parse error: parse error in /home/netbased/public_html/nb_weblog/wp-config.
   php on line 9 Fatal error: Call to a member function on a non-object in /home/
   netbased/public_html/nb_weblog/wp-admin/install.php on line 52 Line 9 looks like:
   $loginsql = DB_USER; (if I counted the lines correctly). I realize I’m that 1%
   that ‘localhost’ doesn’t work for. Any suggestions of what to attempt . . . ?
   Thanks, Don

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/db_host-connection-string-error/#post-85229)
 * Check around your cpanel, and look for any mysql or odbc information – that should
   give an example string.
 *  Thread Starter [DonG](https://wordpress.org/support/users/dong/)
 * (@dong)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/db_host-connection-string-error/#post-85256)
 * Thanks podz for replying.
    Cpanels gives two examples after the database name,
   username and password are created. For Perl the example is: $dbh = DBI->connect(“
   DBI:mysql:netbased_nblog:localhost”,”netbased_nblog”,”<PASSWORD HERE>”); For 
   PHP the example is: $dbh=mysql_connect (“localhost”, “netbased_nblog”, “<PASSWORD
   HERE>”) or die (‘I cannot connect to the database because: ‘ . mysql_error());
   mysql_select_db (“netbased_nblog”); As you can see above, I inserted the PHP 
   connection string between the ‘ ‘ replacing localhost. Does this give you any
   insights? Thanks again, Don
 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/db_host-connection-string-error/#post-85259)
 * Hmm… just realised…..how are you doing this ?
    What you have seen so far is not
   a WP error message, and you should not be seeing any ‘raw’ code like you mention
   in your first post.
 *  [carthik](https://wordpress.org/support/users/carthik/)
 * (@carthik)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/db_host-connection-string-error/#post-85260)
 * Use localhost. That should work fine.
 *  Thread Starter [DonG](https://wordpress.org/support/users/dong/)
 * (@dong)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/db_host-connection-string-error/#post-85264)
 * Some days I think I just hold my mouth wrong. I had started with ‘localhost’ 
   and was recieving an error that many others have reported. Changed the string
   as I mentioned above, got a different error. I attempted ‘localhost’ one more
   time and bingo.
    Sometimes . . . it just escapes me. Sorry for the bother. But
   most importantly, thanks for the support!! Don
 *  [mizar5](https://wordpress.org/support/users/mizar5/)
 * (@mizar5)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/db_host-connection-string-error/#post-85710)
 * geez, i have a huge problem, i tried ti edit something in the template for my
   website, down in the bottom where the default also says ‘powered by wordpress’…
   i think i deleted something very essential, it was after the [http://www.wordpres.org](http://www.wordpres.org)
   and now my website is offline and i also closed the window, so no way of retrieving
   the window in which all of it happened…
    tried to get into the website using 
   my bbedit ftp program but don’t know where to look, because i never go there ..
   anyone????!!!!
 *  [mizar5](https://wordpress.org/support/users/mizar5/)
 * (@mizar5)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/db_host-connection-string-error/#post-85711)
 * ps, i found the template in my ftp files, and i need the right code for just 
   1 line ..
    the part that says “Powered by WordPress” …. what is the exact code
   for that? i’ll try to get the default template page somewhere but if anyone can
   help me with just that one line it would be great .. it now looks like this ..:
   <p class=”credit”><!–<?php echo $wpdb->num_queries; ?> queries. <?php timer_stop(
   1); ?> seconds. –> <cite><?php echo sprintf(__(“ copyright Â¬Â© 2005 Mizar5. 
   All rights reserved. Powered by ************>**WordPress**“), __(“Powered by 
   WordPress, state-of-the-art semantic personal publishing platform”)); ?></cite
   > </body>
 * and where the ****** something got deleted …
 *  [mizar5](https://wordpress.org/support/users/mizar5/)
 * (@mizar5)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/db_host-connection-string-error/#post-85712)
 * already solved the problem!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘DB_HOST connection string Error’ is closed to new replies.

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 8 replies
 * 4 participants
 * Last reply from: [mizar5](https://wordpress.org/support/users/mizar5/)
 * Last activity: [21 years, 1 month ago](https://wordpress.org/support/topic/db_host-connection-string-error/#post-85712)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
