Check wp-config.php
file, open in your WordPress directory, and confirm this lines have correct details:
define('DB_NAME', 'your_database_name');
define('DB_USER', 'your_database_user');
define('DB_PASSWORD', 'your_database_password');
define('DB_HOST', 'localhost'); // Confirm this with your hostname or IP
Check that the user specified in wp-config.php
has access to the database and has the necessary permissions.
Test Database Connection by creating the test-db.php file:
<?php $link = mysqli_connect('localhost', 'your_database_user', 'your_database_password', 'your_database_name'); if (!$link) { die('Connection failed: ' . mysqli_connect_error()); } echo 'Connected successfully!'; mysqli_close($link); ?>
Upload this and test connection, If the above steps don’t resolve the issue, contact your hosting provider for assistance.