Home Guides Glossary

Why is WordPress unable to connect to my database during install?

If you are getting an "Error establishing a database connection" message when trying to connect to WordPress, you need to modify your wp-config.php file to work with our Database servers.

Update your wp-config.php file

This article assumes that you have already created a Database for WordPress in the Hosting Control Panel, downloaded the WordPress installation and uploaded it to your hosting account. If any of these is not the case, see Install WordPress.

Find the Host Name for Your MySQL Database

Use the information in Viewing Your Database Details with Shared Hosting Accounts. Also note your Database Name and Database User Name.

Modify your wp-config.php file

Open wp-config.php with a text editor such as Notepad. The wp-config.php file is located in your WordPress installation folder in your hosting account. If there is no file called wp-config.php, open wp-config-sample.php and save it as wp-config.php. You will be working in this file from now on.

In wp-config.php, locate the section that looks like this example:

/** The name of the database for WordPress */
define('DB_NAME', 'putyourdbnamehere');
/** MySQL database username */
define('DB_USER', 'usernamehere');
/** MySQL database password */
define('DB_PASSWORD', 'yourpasswordhere');
/** MySQL hostname */
define('DB_HOST', 'localhost');

Enter the Database information from your Database as follows:

  • putyourdbnamehere is your MySQL Database Name
  • usernamehere is your MySQL User Name
  • yourpasswordhere is your MySQL password
  • localhost is your MySQL Host Name

WordPress includes security keys which add encryption of information stored in user's cookies. These must be set manually in the wp-config.php file. Locate the section of the file that looks like this:

define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');

Go to WordPress' online key generator and insert the keys in place of the placeholder text in the wp-config.php file. When you are finished, save and close the wp-config.php file.

Re-start the WordPress installation

Start the WordPress installation process again by visiting http://www.coolexample.com/wp-admin/install.php (where coolexample.com/ is your domain and the path where your WordPress installation is located). The installation should now work normally.

Domain Registration

Pay less for website domain names. Register your own .com, .net or .org for as low as $10.18 per year. We have everything you need to get online with your new domain.

Website Builder

Build an amazing website in just under an hour with Website Builder. Take advantage of designs created just for your industry and then customize them to reflect your one-of-a-kind idea.

Website Security

Protect your website and keep customers safe. Your comprehensive Website Security solution. Get peace of mind by securing your websites.

cPanel Hosting

Everything needed to give your website the high-performance home it deserves.  Protect transactions and secure your customer's data with a SSL Certificate
Copyright © 2005 - 2024.  All rights reserved.  Privacy Policy