Title: Database connection failed
Last modified: August 20, 2016

---

# Database connection failed

 *  Resolved [Samkhe](https://wordpress.org/support/users/samkhe/)
 * (@samkhe)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/database-connection-failed/)
 * Hello,
 * I already used Duplicator many time without any problem.
    But today, I’m trying
   to migrate a website on a new dedicated server but I get the error:
 * Database connection failed
    Access denied for user :’xxx@localhost’ (using password:
   YES)
 * Do you have an idea what could be the problem?
    My sql server is using socket,
   could it be the problem?
 * Thanks for your help.
    Sam
 * [http://wordpress.org/extend/plugins/duplicator/](http://wordpress.org/extend/plugins/duplicator/)

Viewing 15 replies - 1 through 15 (of 22 total)

1 [2](https://wordpress.org/support/topic/database-connection-failed/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/database-connection-failed/page/2/?output_format=md)

 *  Thread Starter [Samkhe](https://wordpress.org/support/users/samkhe/)
 * (@samkhe)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/database-connection-failed/#post-3564228)
 * Sorry made a mistake in my first post, the error is:
 * unknown mysql server host : localhost:/tmp/mysql5.sock
 *  [Cory Lamle](https://wordpress.org/support/users/corylamleorg/)
 * (@corylamleorg)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/database-connection-failed/#post-3564361)
 * This might be because your host requires a different port number than 3306. This
   you will need to validate with the hosting provider. If that is the case then
   the next version has support for port numbers, you can get it by following these
   instructions:
 *  -> Browse to [http://wordpress.org/extend/plugins/duplicator/developers/](http://wordpress.org/extend/plugins/duplicator/developers/)
   -
   > Look for the section “Other Versions” -> Click on “Development Version” and
   download the zip plugin file -> Uninstall your current version and install this
   one -> Note: The version number might still be the same but the source code is
   different.
 * Hope that helps!
 *  [Cory Lamle](https://wordpress.org/support/users/corylamleorg/)
 * (@corylamleorg)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/database-connection-failed/#post-3564479)
 * Hi Samkhe,
 * Did you get past this issue?
 *  [Fr3ak81](https://wordpress.org/support/users/fr3ak81/)
 * (@fr3ak81)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/database-connection-failed/#post-3564595)
 * Hi
    I have the same issue. And i’m sure that i must use port 3307 I downloaded
   the Development Version, as it was wrote above. but i don’t know where i can 
   change it.
 *  [Cory Lamle](https://wordpress.org/support/users/corylamleorg/)
 * (@corylamleorg)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/database-connection-failed/#post-3564596)
 * Just add the port number to the end of your host.
    Example localhost:3307
 *  [Fr3ak81](https://wordpress.org/support/users/fr3ak81/)
 * (@fr3ak81)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/database-connection-failed/#post-3564597)
 * unfortunately it does not work for me, according to the host without a port it
   show message “DATABASE CONNECTION FAILED! Access denied for user …”
    with the
   specified port: “DATABASE CONNECTION FAILED! Unknown MySQL server host ..” I’m
   sure that I gives good data written as a php file for this database connection
   to work. I’m not sure if it’s important but the combination created a php file
   did not work specify the host and port in a way, for example, localhost: 3307
   it must be new mysqli (host, user, password, database, PORT) Sory for my english
   🙁
 *  [Cory Lamle](https://wordpress.org/support/users/corylamleorg/)
 * (@corylamleorg)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/database-connection-failed/#post-3564598)
 * It should work… I have used it several times and so have other people without
   issues…
 * The code is written as such:
 * `$db_port = parse_url($_POST['dbhost'], PHP_URL_PORT);`
 * Then the value is feed into the mysqli function…
 * Hope that helps!
 *  Thread Starter [Samkhe](https://wordpress.org/support/users/samkhe/)
 * (@samkhe)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/database-connection-failed/#post-3564600)
 * Sorry for my late answer.
 * I found the solution, it worked for me.
    I have a tutorial in french that I translated
   specialy for you on my blog. (look at the end of the page for the english translation)
 * [http://www.seo-expert.fr/duplicator/](https://wordpress.org/support/topic/database-connection-failed/www.seo-expert.fr/duplicator/?output_format=md)
 * Hope it can help
 *  [Cory Lamle](https://wordpress.org/support/users/corylamleorg/)
 * (@corylamleorg)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/database-connection-failed/#post-3564601)
 * Hey Samkhe,
 * Thanks for that link… I’ll add it to the todo list…
 * Cheers~
 *  [deltabert](https://wordpress.org/support/users/deltabert/)
 * (@deltabert)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/database-connection-failed/#post-3564631)
 * Hi Cory,
 * I recently found your great plugin and it can prevent a lot of headaches! I have
   two different host providers, and on one provider it works perfectly, tested 
   it both ways! Really great!
    But the other host provider uses a port number (
   localhost:3351) for the connection to MySQL, and That fails. I tried your developer
   version, installed on the source site, and made ​​the packet again with the developper
   version. Transferred packet and installer to the target host and tried again 
   with localhost:3351, but failed ;-( I am sure that all other parameters are good,
   I am able to access database with the phpmyadmin, and the database server-id 
   and user-id/ password are the same as in the wp-config.php file.
 * So i do not know what to do next. Contacted my hosting provider and thay are 
   looking into it right now.
 * Hope you have a suggestion?
    Bert
 * Btw, the link [http://www.seo-expert.fr/duplicator/](http://www.seo-expert.fr/duplicator/)
   does not respond anymore… So that could not give me any help either
 *  [deltabert](https://wordpress.org/support/users/deltabert/)
 * (@deltabert)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/database-connection-failed/#post-3564632)
 * Cory,
 * I tried something in your Installer script. Force the script to use the database
   port number.
 * I switched off line 525:
    // $db_port = parse_url($_POST[‘dbhost’], PHP_URL_PORT);
 * And added at line (525) to use port 3351
 * $db_port = ‘3351’;
 * Then the connection test Succeeds, but when I start Run Deployment the script
   comes again with a database connection failure…
 *  [deltabert](https://wordpress.org/support/users/deltabert/)
 * (@deltabert)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/database-connection-failed/#post-3564633)
 * Sorry, I switched off line 524
 *  [deltabert](https://wordpress.org/support/users/deltabert/)
 * (@deltabert)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/database-connection-failed/#post-3564634)
 * I noticed a second place where you did the same to collect the database port.
   line 1188, so i commented this line also and placed on line 1189
    $db_port = ‘
   3351’;
 * But this wasn’t a success either.
 *  [deltabert](https://wordpress.org/support/users/deltabert/)
 * (@deltabert)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/database-connection-failed/#post-3564635)
 * Extra info, System Status:
 * REQUIREMENTS click links for details
    Root Directory Pass Safe Mode Off Pass 
   MySQL Support Pass PHP Version: 5.2.17 (PHP 5.2.17+ is required) Pass
 * CHECKS
 * Web Server: Microsoft IIS
    OK Open Base Dir: Off Good PHP SAPI: cgi-fcgi PHP 
   ZIP Archive: Is Installed CDN Accessible: Yes
 *  [Cory Lamle](https://wordpress.org/support/users/corylamleorg/)
 * (@corylamleorg)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/database-connection-failed/#post-3564636)
 * Hey deltabert,
 * Did you check to make sure the mysql user is setup with full permissions and 
   also setup in the hosts table correctly?

Viewing 15 replies - 1 through 15 (of 22 total)

1 [2](https://wordpress.org/support/topic/database-connection-failed/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/database-connection-failed/page/2/?output_format=md)

The topic ‘Database connection failed’ is closed to new replies.

 * ![](https://ps.w.org/duplicator/assets/icon-256x256.png?rev=2906985)
 * [Duplicator - Backups & Migration Plugin - Cloud Backups, Scheduled Backups, & More](https://wordpress.org/plugins/duplicator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/duplicator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/duplicator/)
 * [Active Topics](https://wordpress.org/support/plugin/duplicator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/duplicator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/duplicator/reviews/)

 * 22 replies
 * 5 participants
 * Last reply from: [Cory Lamle](https://wordpress.org/support/users/corylamleorg/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/database-connection-failed/page/2/#post-3564644)
 * Status: resolved