I hope you can help me to fix my problem.

I am using WordPress for the first time, and I don't know why I am getting Error establishing a database connection knowing that I have created the file wp-config.php by myself then I provided the information of my database. I create a virtual host because I need to work just in localhost.

for the information: I am using the above version below:

WordPress 5.5.1 / wampserver 3.2.3 / PHP 7.4.9 / MySQL 5.7.31

thank you for your support!!!

  • First of all thank you for your comments, I have tried to work with the 32 bits version of wampserver even if i have windows 64 bits. And finally it works , i don't know why but at least i am able to establish connection now . Thank you !
    – codepro
    Commented Sep 4, 2020 at 13:01

1 Answer 1


Are you creating WordPress from scratch? You do not need to create the wp-config.php manually. Just open your installed WordPress from your browser and it will run an installer for you.

If you migrated from an existing WordPress installation (from another server/PC), check your database settings in wp-config.php file.

// ** MySQL settings ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'amadeus' );

/** MySQL database username */
define( 'DB_USER', 'root' );

/** MySQL database password */
define( 'DB_PASSWORD', '' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
  • thank you @Earlee for the answer , but even if i don't create the wp-config.php by myself , i still receive Error establishing a database connection and i don't think that it's the database setting problem ! should i reinstall the wampserver ?
    – codepro
    Commented Sep 3, 2020 at 9:00
  • Does the database exist, are you providing the right details. Only in these situations, this will happen, if credentials are wrong, or if database doesn't exist, does the MySQL server in wamp server started correctly Commented Sep 4, 2020 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.