• Hello everyone,

    I cannot install wordpress as I face issue during installation.

    So I setup a database using phpmyadmin. Then I tried to set up wordpress by inputting database name, username and password. But I get the error “Error establishing a database connection”. I researched the internet a lot. What I discovered was that there is no wp-config.php file in root folder of wordpress. I used the sample file to manually put database details but then it says that file already exists, and then I get the same error i.e error connecting to database.

    I also tried to use the IP instead of localhost and also put the port in the new wp-config file I created, no change.

    What seems to be the issue? I need to get over this as soon as possible. So looking forward to any support responses

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello @zero47,

    If you’re unable to see the wp-config.php file in your XAMPP server’s WordPress installation directory, there are a few possible reasons for this:

    Hidden files: By default, some operating systems and file explorers hide certain files, including files that start with a dot (.) like wp-config.php. Make sure that your file explorer is set to display hidden files. Check your file explorer settings and enable the option to show hidden files.

    File extension visibility: If your file explorer is configured to hide file extensions, the wp-config.php file might be named as wp-config instead of wp-config.php. Verify if file extensions are visible in your file explorer settings.

    Incorrect installation path: Double-check that you are looking in the correct directory for your WordPress installation. The wp-config.php file should be located in the root directory of your WordPress installation.

    Incorrect XAMPP setup: It’s possible that there was an issue during the installation or setup of XAMPP.

    If you’ve confirmed the above points and still can’t find the wp-config.php file, you can try manually creating the file using a text editor ( Notepad, Sublime Text, Visual Studio Code).

    Thread Starter zero479

    (@zero479)

    • I checked. No files were hidden
    • The only file that exists was wp config sample. Wp config file was not there. I checked the same thing on another computer. Same setup same everything. WordPress is installing just fine and wp config file is there.
    • Yes I’m looking at the correct directory
    • I mentioned just that. I mentioned how I created the wp config myself. But then I get a message that file already exists. Then it asks me to start installation again. When I click the button, I get the same error

    So I setup a database using phpmyadmin. Then I tried to set up wordpress by inputting database name, username and password. But I get the error “Error establishing a database connection”.

    If you’re not using the MySQL root account, did you remember to grant the user you created permissions on the database?

    What I discovered was that there is no wp-config.php file in root folder of wordpress.

    This is normal, and what’s to be expected by default. The installer creates the wp-config.php file after you successfully run it. But as you couldn’t get past the database connection test, the file was not created.

    But, you can also manually create the wp-config.php file, which you did.

    Except if the installer’s database connection test failed, manually putting the same database connection info into the wp-config.php file will yield exactly the same result.

    I used the sample file to manually put database details but then it says that file already exists.

    I believe the message that the file already exists is from the WordPress installer, and not from your computer’s file system explorer.

    If the message is from the WordPress installer, then this is also to be expected: the existing file mentioned is the one you created, and not some other one existing somewhere else.

    Remember, by default, there is no wp-config.php file, and it is the installer’s job to create it. But before creating it, the installer first checks to see if there’s an existing one it can use. And it found the one you manually created (hence the “file already exists” message). But then it couldn’t continue further with the installation due to its inability to connect to the database.

    My suspicion is that the database user may not have been granted any (or the appropriate) privileges on the database (if you’re not using the root user).

    Thread Starter zero479

    (@zero479)

    I believe the message that the file already exists is from the WordPress installer, and not from your computer’s file system explorer.

    Yes it was from the wordpress installer that is correct

    My suspicion is that the database user may not have been granted any (or the appropriate) privileges on the database (if you’re not using the root user).

    I double checked everything. Even created multiple databases and users just to confirm that I’m not missing anything. This is one user I created. The same settings work on another PC but not on mine.

    https://pasteboard.co/cRHmeoQqfEBo.png

    • This reply was modified 1 year, 5 months ago by zero479. Reason: I uploaded an image but it seems the image doesn't show up. So used a link
    Thread Starter zero479

    (@zero479)

    Thank you for a step by step guide to ensure I don’t miss anything. But I can assure you that I’ve double-checked everything, created many databases and users to ensure I hadn’t missed anything, installed every from official websites with the latest versions.

    But I really can’t understand what’s wrong. MySQL services is running and there is no issues with XAMPP, atleast no errors or issues in log files. But no matter what I do, I cannot link the database with wordpress because of the error I mentioned.

    Can you think of anything that could be causing the issue? Thanks a lot!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Cannot Install WordPress Xampp Error Establishing Connection with Database’ is closed to new replies.