How to fix localhost WordPress wp-admin setup-config.php error (Easy guide)
Introduction
Facing the setup-config.php error on localhost? This issue appears when WordPress cannot find or load your configuration file. The good news? It’s easy to fix. This guide walks you through all causes and solutions—perfect for beginners and developers setting up WordPress locally on XAMPP, WAMP, or MAMP.
What causes the setup-config.php error?
This error appears when WordPress cannot read or create the wp-config.php file. Common triggers include:
-
Incorrect database name, username, or password
-
Missing
wp-config.phpfile -
Wrong database host settings
-
Incorrect folder permissions
-
Corrupted WordPress installation
-
MySQL not running on local server
You usually see a message like:
“There doesn’t seem to be a wp-config.php file. I need this before we can get started.”
Solution 1: Create wp-config.php manually
-
Go to your WordPress folder → find
wp-config-sample.php. -
Make a copy → rename it to
wp-config.php. -
Open it in a text editor.
-
Add your database details:
-
Save the file.
-
Reload
http://localhost/yourfolder/wp-admin.
Solution 2: Check if MySQL is running
If MySQL is off, WordPress shows this error.
XAMPP:
Start Apache + MySQL
WAMP:
Green icon = OK
Orange/red = MySQL not working
MAMP:
Start Servers → MySQL + Apache
Once MySQL is active, refresh the setup page.
Solution 3: Fix wrong database name
Most users enter the wrong DB name.
Check using phpMyAdmin → Databases.
Make sure the DB name matches exactly what you put in wp-config.php.
Solution 4: Reset database user/password
For local setups:
-
Username = root
-
Password = blank (empty)
If you changed it earlier, reset it from phpMyAdmin → User accounts.
Solution 5: Check folder permissions
On Windows or macOS, WordPress may fail to create files.
-
Right-click WordPress folder
-
Properties → Permissions
-
Give full read/write access
Reload the page.
Solution 6: Replace corrupted WordPress files
If nothing works:
-
Download fresh WordPress from wordpress.org
-
Replace all files except
/wp-content/ -
Try again
This fixes corrupted core files.
Solution 7: Auto-generate wp-config.php
WordPress can create the file automatically.
Go to:
Follow the wizard:
-
DB name
-
Username: root
-
Password: (empty)
-
Host: localhost
-
Table prefix: wp_
Click Run Installer.
Bonus: Recommended localhost setup
Use:
-
XAMPP for Windows
-
MAMP for macOS
-
LocalWP for beginners
-
Laragon for fastest performance
FAQ (SEO-friendly)
1. Why does setup-config.php keep loading?
Because WordPress can’t find wp-config.php.
2. What is wp-config.php used for?
It connects WordPress to your database.
3. Can I delete setup-config.php?
No, it’s part of the installation wizard.
4. Is localhost database password empty?
Yes, most local servers use an empty password.
Conclusion
The setup-config.php error in localhost is common, but easy to fix by checking your database, MySQL service, and wp-config.php file. Once corrected, your local WordPress site will run smoothly without issues.
Post a Comment