Title: Error establishing database connection
Last modified: August 18, 2016

---

# Error establishing database connection

 *  [minh](https://wordpress.org/support/users/minh/)
 * (@minh)
 * [22 years ago](https://wordpress.org/support/topic/error-establishing-database-connection-1/)
 * Hi all,
    I’ve been trying to install wordpress v 1.2, but kept getting this: 
   Error establishing a database connection! This probably means that the connection
   information in your wp-config.php file is incorrect. Double check it and try 
   again. Are you sure you have the correct user/password? Are you sure that you
   have typed the correct hostname? Are you sure that the database server is running?
   my database name and username is inspers_minh and i’m currently hosted on a subdomain.
   i am very sure the database name and username are correct and that she has assigned
   my username to the database, since i’ve gotten my host to doublecheck for me.
   the copy&paste that she has given me is: inspers_minh Users in minh inspers_minh(
   Privileges: ALL PRIVILEGES) Connection Strings Perl $dbh = DBI->connect(“DBI:
   mysql:inspers_minh:localhost”,”inspers_minh”,”<PASSWORD HERE>”); PHP $dbh=mysql_connect(“
   localhost”, “inspers_minh”, “<PASSWORD HERE>”) or die (‘I cannot connect to the
   database because: ‘ . mysql_error()); mysql_select_db (“inspers_minh”); help,
   anyone? i can’t wait to get wordpress up and running on my site.

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

 *  [bAs](https://wordpress.org/support/users/bas/)
 * (@bas)
 * [22 years ago](https://wordpress.org/support/topic/error-establishing-database-connection-1/#post-62248)
 * do you have phpmyadmin access? or some sort of cpanel in order to creat the db
   or edit the user/pw for it?
    `$dbh = DBI->connect("DBI:mysql:database_name:localhost","
   database_username","<PASSWORD HERE>");` `PHP $dbh=mysql_connect ("localhost","
   database_username", "<PASSWORD HERE>") or die ('I cannot connect to the database
   because: ' . mysql_error()); mysql_select_db ("database_name");  it looks like
   your using the same username for the database name. you need 4 things to hook
   up: database username database name localhost password
 *  Thread Starter [minh](https://wordpress.org/support/users/minh/)
 * (@minh)
 * [22 years ago](https://wordpress.org/support/topic/error-establishing-database-connection-1/#post-62281)
 * nope i don’t have phpmyadmin/ cpanel access, but i can get my host to edit for
   me. so i guess the database name has to be different from the database username?
 *  [pericat](https://wordpress.org/support/users/pericat/)
 * (@pericat)
 * [22 years ago](https://wordpress.org/support/topic/error-establishing-database-connection-1/#post-62286)
 * my database’s name and my username are the same, so I don’t think that can be
   your issue.
    Try this, if you like. Create a file on your website so: `<?php``
   $server='localhost';` `$user='inspers_minh';` `$pass='your-password';` `$pipe
   = mysql_connect ($server, $user, $pass);` `echo $pipe;` `?>` Name it whatever
   you like .php. Then run it in a browser. If you get a response such as ‘Resource
   ID’ somethingorother, you have a valid connection. If not, you’ll get a honking
   big error message. At which point, you need to bug your provider again.
 *  Thread Starter [minh](https://wordpress.org/support/users/minh/)
 * (@minh)
 * [22 years ago](https://wordpress.org/support/topic/error-establishing-database-connection-1/#post-62288)
 * I got this: Warning: mysql_connect(): Access denied for user: ‘inspers_minh@localhost’(
   Using password: YES) in /home/inspers/public_html/minh/me.php on line 5
    So i
   shall bug my host again (hope she won’t be annoyed!) Thanks for the help 🙂
 *  [pericat](https://wordpress.org/support/users/pericat/)
 * (@pericat)
 * [22 years ago](https://wordpress.org/support/topic/error-establishing-database-connection-1/#post-62289)
 * Bug her. Show her the output. I suspect she’s made a typo in setting up your 
   username. Either that, or your password is not what you think it is. Either way,
   you’ll have to ping her again to double-check those items.
 *  Anonymous
 * [22 years ago](https://wordpress.org/support/topic/error-establishing-database-connection-1/#post-62651)
 * I’m having the same exact problem / same results.
 *  [pericat](https://wordpress.org/support/users/pericat/)
 * (@pericat)
 * [22 years ago](https://wordpress.org/support/topic/error-establishing-database-connection-1/#post-62655)
 * Then, at least so far, the solution is the same. Talk to your provider, and explain
   that MySQL won’t accept your username or your password, and could they provide
   you with a new set.
 *  [bAs](https://wordpress.org/support/users/bas/)
 * (@bas)
 * [21 years, 12 months ago](https://wordpress.org/support/topic/error-establishing-database-connection-1/#post-62698)
 * If your host doesn’t allow you to have access to phpmyadmin to work your database–
   you may want to consider a new one. Yes the username and database name can be
   the same, but check anyway. phpmyadmin allows you to work on your own database
   with an easy gui. especially usefull if you locked yourself out and need to reset
   your password for your wp. I have my hosting through [http://www.pehosting.com](http://www.pehosting.com)
   their site gives an example of what you get.
 *  [laslo](https://wordpress.org/support/users/laslo/)
 * (@laslo)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/error-establishing-database-connection-1/#post-62982)
 * hello pericat,
    I’m having the same problem that everybody with installin.php
   i ran the test script you suggested, and i’ve got “No input file specified.”
 * any ideas?
    [http://www.imaginaccion.net/cinencuentro/test.php](http://www.imaginaccion.net/cinencuentro/test.php)
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/error-establishing-database-connection-1/#post-62983)
 * That means you don’t have a valid connection to your database. Are you sure all
   the 4 pieces of information in the wp-config file are correct?

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

The topic ‘Error establishing database connection’ is closed to new replies.

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 10 replies
 * 6 participants
 * Last reply from: [moshu](https://wordpress.org/support/users/moshu/)
 * Last activity: [20 years, 7 months ago](https://wordpress.org/support/topic/error-establishing-database-connection-1/#post-62983)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
