Knowledgebase

How Your Website Connects to Its Database Print

  • databasesphpmyadmin, databases, database, troubleshooting, wordpress, cpanel, php, password, errors, webhosting
  • 0

The configuration that makes it work.

THE FOUR VALUES

Database name Username Password Host

All four must be correct or the site shows a connection error.

WHERE THEY LIVE

  • WordPress: wp-config.php, as DB_NAME, DB_USER, DB_PASSWORD and DB_HOST
  • Joomla: configuration.php
  • Laravel: the .env file
  • Others: their own configuration file

THE HOST VALUE

On shared hosting this is localhost. The database runs on the same server as the site.

If it says anything else, that is usually wrong.

THE PREFIX

Both the database name and the username carry your cPanel username followed by an underscore.

If your cPanel user is zkhuser and you create a database called shop, the actual name is zkhuser_shop.

Forgetting the prefix is the most common configuration error.

THE TABLE PREFIX

Separate from the above. It prefixes the tables inside the database, typically wp_ for WordPress.

It is set at installation and must match the actual tables.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot