Kanchon Gharami
Kanchon Gharami

Reputation: 949

WordPress 'Error establishing a database connection'

I am trying to start my 1st project in WordPress and put this data

  1. Database Name : wp-project-1
  2. DB_USER : root
  3. DB_PASSWORD : ``
  4. DB_HOST : localhost
  5. Table Prefix : wp_

And in my wp-config-sample.php:

define( 'DB_NAME', 'wp-project-1' );

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

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

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

But it says error like this when I submit them:

Error establishing a database connection
This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.

Are you sure you have the correct username and password?
Are you sure you have typed the correct hostname?
Are you sure the database server is running?
If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

Here I am using xampp server, and my xampp port number is 3307 (I change that cause 3306 was busy every time.)

How can I fix it?

Upvotes: 1

Views: 2725

Answers (2)

Amit Kumar PRO
Amit Kumar PRO

Reputation: 1240

Please change your wp-config-sample.php file to wp-config.php

Upvotes: 1

user15248833
user15248833

Reputation:

on xampp you can open control panel where it says apache hit the config select php ini and find the following

mysqli.default_port=

Upvotes: 3

Related Questions