Knowledgebase

Configuring Database Access Print

  • phplaravel, database, cpanel, troubleshooting, password, caching, errors, guide
  • 0

Connecting.

WHAT TO SET

The connection type, host, database name, username and password.

WHERE

In the environment file, never in code.

WHAT TO CREATE FIRST ON CPANEL

A database, a user, and the association between them, with appropriate privileges.

WHAT TO REMEMBER ABOUT CPANEL NAMING

Databases and users are prefixed with your account name.

WHAT THAT CAUSES

Configuration referring to unprefixed names, which fails.

Use the full names as shown in cPanel.

WHAT HOST TO USE

The local host, in almost all cases.

WHAT TO CHECK IF CONNECTION FAILS

The exact names, including the prefix That the user is associated with the database That the password is correct That privileges were granted

WHAT THE ERROR USUALLY SAYS

Access denied, which almost always means names or privileges.

WHAT TO AVOID

Using a database user with more privileges than needed Reusing the same credentials across applications

WHAT TO DO AFTER CHANGING CONFIGURATION

Clear the configuration cache.


Was this answer helpful?
Back

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


Trustpilot