skip to Main Content

I’m trying to install wordpress on my localhost with XAMPP. My Apache module is on ports 80,443 and my MySQL module is on port 3307 (default is 3306). I can’t start installing wordpress. After entering localhost/wordpress in my browser there apears error "Error establishing a database connection". I don’t have wp-config.php file i guess it creates after starting installation which i can’t start

I tried changing wp-config-sample.php but it looks like it doesn’t change anything i also tried creating wp-config.php on my own and changing DB details there

2

Answers


  1. You have to change config.php not config-sample.php.

    define( 'DB_NAME', 'your_dbname' );
    define( 'DB_USER', 'your_dbuser' );
    define( 'DB_PASSWORD', 'your_dbpasw' );
    define( 'DB_HOST', 'localhost:3307' );
    

    That’s all you need. Just append ":" after localhost (or your machine ip address/host name)

    Login or Signup to reply.
  2. Having a database connection issue would mean there’s a "wp-config.php" file being used, and the credentials are incorrect — hostname, port, credentials, or possibly not having a database created yet.

    During an initial setup, WordPress will create the wp-config.php file with the MySQL credentials, when the connection is a success. If you’re not getting a setup page, review your "wp-config.php" file, or delete all of the contents and start over with a new WordPress download. Extract the zip/tar.gz archive, and move the contents in the "wordpress/" folder into your site’s DocumentRoot.

    You can also test your MySQL credentials with this command:

    mysql -h localhost -P 3307 -u DatabaseUsername -p
    

    The uppercase "P" is for port, and the lowercase "p" is for password. If entering the password at the prompt is successful, check that you’ve got a database with show databases;.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search