Update the database connection settings for an application to ensure it can communicate with your MySQL or MariaDB database. This process is required when you change your database name, username, or password, or when you move your application to a new hosting environment.
Before you begin
You will need:
Access to your application's configuration files or administrative dashboard.
Your current MySQL/MariaDB database credentials (database name, username, and password).
The IP address or hostname of the database server (if the application is hosted on a different server than the database).
Update the application configuration
Depending on your application's architecture, you will typically update these settings in one of two ways:
Updating via a configuration file
Most applications (such as WordPress, Joomla, or custom scripts) use a configuration file to store database details.
Access your application's root directory using a file manager or FTP client.
Locate the configuration file. Common examples include
wp-config.php(WordPress) or.env(Laravel/various frameworks).Open the file and locate the database configuration section.
Update the following fields with your current credentials:
DB_NAME: The name of your database.
DB_USER: Your database username.
DB_PASSWORD: Your database password.
DB_HOST: The hostname or IP address of the database server (often
localhostif the application and database are on the same server).
Save the file and upload it back to your server if you edited it locally.
Updating via an administrative dashboard
Some applications and Content Management Systems (CMS) allow you to update these settings through a web interface.
Log in to your application's administrative dashboard.
Navigate to the Settings or Configuration section.
Locate the Database or Database Connection settings.
Update the database name, username, and password fields.
Select Save or Update.
Confirm the result
After updating the settings, verify that the application is functioning correctly:
Refresh your website or application's home page.
Log in to the administrative dashboard to ensure the connection is active.
If the application displays a "Connection Error" or a "Database Error," the credentials provided in the configuration are incorrect.
Limitations
Localhost vs. Remote Host: If your application and database are on the same server, the host is typically
localhost. If they are on different servers, you must use the correct IP address or hostname.Permissions: Ensure the database user has the necessary permissions to access the specific database.
Port Numbers: Unless your database is running on a non-standard port, you do not need to specify a port number in the configuration.
