Title: Problem connecting to database
Last modified: August 21, 2016

---

# Problem connecting to database

 *  [Slisse23](https://wordpress.org/support/users/slisse23/)
 * (@slisse23)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problem-connecting-to-database-2/)
 * Hey all,
 * I wrote some code directly in functions.php for creating something like a tagcloud.
   Which wordked out fine when I was testing this on a wamp localhost server..
    
   When I’m trying to integrate the exact same code into an online site.. It’s giving
   me the following error.
 * access denied for user ‘blabla’@’localhost’ (using password yes)
 * I’m trying to connect to like to the database the same way I did it on my local
   server.. And yes I’m sure my user/password is correct..
 * $db = new mysqli(“localhost”, “blabla”, “my_pass”, “my_database”);
 * Anyone an idea of what i’m doing wrong ?
    Should I use something else than “localhost”?
 * Thanks!
 * Greats,
 * Davey

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

 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problem-connecting-to-database-2/#post-4333686)
 * You might have to use something different to `localhost`. That depends on what
   your hosting company has set up. they are the first people to ask about this 
   as it’s almost always some problem with the settings that they’ve given that 
   they need to work out.
 * Just making sure though… This is a stupid question, but you never know.
 * You’re not trying to connect to the database on your local machine from the web
   server are you?
 *  [Tomi Toivio](https://wordpress.org/support/users/tomitoivio/)
 * (@tomitoivio)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problem-connecting-to-database-2/#post-4333687)
 * Maybe you should use [$wpdb](http://codex.wordpress.org/Class_Reference/wpdb)?

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

The topic ‘Problem connecting to database’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 3 participants
 * Last reply from: [Tomi Toivio](https://wordpress.org/support/users/tomitoivio/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/problem-connecting-to-database-2/#post-4333687)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
