• Hi everyone,

    I’m trying to install WordPress on XAMPP on my Macbook Pro. I’ve created a database called “wordpressdb” in phpMyAdmin and edited the <code class=””>wp-config.php file with the following information:

    • <code class=””>DB_NAME: wordpressdb
    • <code class=””>DB_USER: admin
    • <code class=””>DB_PASSWORD: ********
    • <code class=””>DB_HOST: localhost

    However, when I visit https://localhost/wordpress/, I receive the error message: “Error establishing a database connection.”

    I’m using WordPress version 6.6.2 and XAMPP version 8.2.4 I’ve tried verifying the database credentials and restarting XAMPP, but the issue persists.

    Can anyone suggest any solutions to resolve this error and successfully connect WordPress to my database?

    Thank you!

    • This topic was modified 1 month, 1 week ago by James Huff. Reason: moved to Localhost Installs since this is a localhost install

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • This is really not a WordPress-specific issue.

    Ensure the database user admin has full permission granted on the databse wordpressdb. Simply creating the database and user are not enough: the user must be granted permission on the database.

    If you continue to have issues with this, I’ll recommend switching to an all-in-one WordPress local server like LocalWP by Flywheel (https://localwp.com/) or Studio by WordPress.com (https://developer.wordpress.com/studio/). These will give you a complete WordPress site out of the box in a click or two, with no need to manually install WordPress or mess with databases.

    Good luck!

    @ipwsite the information you have shared is not enough for debugging the issue !

    These are some possible fixes i can think of

    1. Check MySQL Server Status: Ensure that the MySQL server is running in XAMPP. You can check this by:
      • Opening the XAMPP control panel.
      • Verifying that the MySQL service is running (it should be green).
    2. Use?127.0.0.1?Instead of?localhost: Sometimes, XAMPP on macOS may have issues resolving?localhost. Try changing?DB_HOST?to?127.0.0.1?in your?wp-config.php?file:define('DB_HOST', '127.0.0.1');
    3. Check the User Privileges: Ensure that the?admin?user has privileges for the?wordpressdb?database. In phpMyAdmin:
      • Go to the?Users?tab.
      • Check if the?admin?user has been assigned appropriate privileges for the?wordpressdb?database.
    4. Check for MySQL Port Conflict: Verify that MySQL is running on the default port (3306). If it’s running on a different port, you’ll need to specify it in?wp-config.php:define('DB_HOST', '127.0.0.1:3306'); // Replace with the correct port if it's different




Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.