“We were able to connect to the database server” error in WordPress


I could not find an answer. Have a production website with production DB. Have backed up the DB and restored to a development environment where I also created a development website in the same server, same cPanel, same user and same password for both DBs. Is a Magento platform 1.9.2, although I do not think is important. Here is the issue: I can execute SQL in the development DB but the same SQL sentence would not execute in the production DB. Also I have uploaded WP to the development and isntalled using the development db for the magento installation, but when I try to run the WP installation for the production site, WP replies "We were able to connect to the database server". Remote MySQL, firewall, etc are the same for both DB, what could be the cause of this and how do I solve it? Thank you.


The error We were able to connect to the database server means WP <em>can</em> connect to the database, but the user or password or permissions are wrong.

Are you sure database user in wp-config.php has adequate permissions for the database? Try giving the user all privileges, i.e. SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES for the database.

And, try WP_DEBUG to find any php errors that may indicate other connection issues.


define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true );

in wp-config.php and the debug.log file will be in wp-content.

And optionally add this

define( 'WP_DEBUG_DISPLAY', true);

to wp-config.php to log and dump them to the browser.

See <a href="https://codex.wordpress.org/WP_DEBUG" rel="nofollow">https://codex.wordpress.org/WP_DEBUG</a>


  • Use gulp for typescript compilation
  • Python + Selenium: Wait until element is fully loaded
  • List files with multiple conditions part2
  • How can I do printf style debugging over a slow CAN bus - with constant strings on the remote tool,
  • Reading File into Array - Java
  • How can you check if a type is Optional in Swift?
  • powershell putting linebreaks inappropriate places in output
  • How to inject Session/User object after bootstrapping?
  • Why is an array of all `ids` needed in a normalized state shape?
  • When an object has the same name as its class in a VB project, how do I rename the object without al
  • Unity3d 5 WavePro Dynamic MeshCollider
  • How to check if OWLObjectPropertyExpression between classes exists?
  • SendFile issues with respect to control flow in Express Middleware
  • Xcode App doesn't release memory
  • Push Notifications: Associating a device token with a device
  • JQuery Adding link to a table cell
  • Avmutable composition , lost orientation when adding audio to a video made with frames
  • Android LinearLayout Line Breaks in XML
  • MvvmCross - View not loaded
  • how to reload page after uploading images
  • Preloading webView doesn't work - trying to reduce loading time
  • Avoiding duplicated data in same table with jquery
  • Insert statement not working using execute(array()) of PDO Extension
  • Making query to find nearest multiple(Lat,Long) from the single(Lat,Long)
  • jqGrid Filter Toolbar and Date and Select filters
  • Node.js - Why does my callback get called 3 times for each request?
  • Can Node.JS on OpenShift be upgraded?
  • Making Django.contrib.auth store plain-text password
  • Slick: How can I combine a SQL LIKE statement with a SQL IN statement
  • How to convert days into months using datetime in Python3?
  • Implementation of timeout in LDAP
  • Getting Microsoft Calibri font on Amazon EC2 ubuntu
  • How to check if a database and tables exist in sql server in a vb .net project?
  • Add font awesome icon to custom add to cart button in Woocommerce 3
  • how to read to huge file into buffer
  • How to handle div that is created dynamically in a table
  • Google App Engine backend servlet not responding
  • How to encrypt Connectionstring written in web.config from codebehind?
  • Android Library Projects on Windows and Mac