WordPress Install.Php Error


I’m having an issue with a fresh install of wordpress.

The exact steps I have taken:
* installed xampp to c:\xampp
* when starting the apache server I was getting a duplicate port error. So I changed the httpd.conf and httpd-ssl.conf to point to port 8080 and 4433 respectively. The apache server then started with out any issues.
* made a folder called “wordpress” in the htdocs directory and copied the contents of my wordpress download into it.
* created a blank database in mysql with a user that has all CRUD and schema alteration permissions.
* renamed the sample config to just wp-config.php
* changed database details
> DB_HOST = localhost:8080
> DB_COLLATE = utf8_general_ci
* open “http://localhost:8080/wordpress/wp-admin/install.php” in the browser, proceeds to hang until timeout. Changed timeout to 300 seconds.

When trying to set DB_HOST to localhost:3306 I get a “Error establishing a database connection” message.

Not really sure what I’m missing here.

First, me personally, I’m using Laragon instead XAMPP. I used to use XAMPP or WampServer, but now switched to Laragon because it’s easier and more time-saving. Of course it’s not the case, but you should try it.

To install WordPress normally (like most people do), you don’t have to rename the sample config or ‘wp-config-sample.php’ to ‘wp-config.php’. Just open the URL e.g “http://localhost:8080/wordpress/” and it will be redirected to “http://localhost:8080/wordpress/wp-admin/setup-config.php”, there you fill the requirement fields.

But it seems you are installing WordPress manually by doing what’s been stated here:
https://wordpress.org/support/article/how-to-install-wordpress/ (From Step 1 to Step 5)

The error of “Error establishing a database connection” is telling you that for some reason the PHP code was unable to connect with your MySQL database. And this error mostly caused by incorrect details in your ‘wp-config-sample.php’.

/** The name of the database for WordPress */
define(‘DB_NAME’, ‘database_name_here’);

/** MySQL database username */
define(‘DB_USER’, ‘username_here’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘password_here’);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

Have you tried just put ‘localhost’ for the DB_HOST instead? or ‘localhost:3306’ (becasuse it’s the port that your MySQL is referring to by default)

3306 is default port for MySQL, You just need to enter ‘localhost’ as used in default wp-config.php file.

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

Leave a Reply

Your email address will not be published. Required fields are marked *