Local Community

Error establishing a database connection SEND HELP

Installed Local on a Mac and PC. Activated Mac version and I am up and running. However, on my PC:

  1. Installation hung up for about 20 minutes
  2. After installation completed, I clicked on Admin button and a XAMPP screen opened in the browser. Nothing else.
  3. Reinstalled XAMPP
  4. Opened Local>Ran site>clicked on Admin:

Error establishing a database connection

This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost . This could mean your host’s database server is down.

  • Are you sure you have the correct username and password?
  • Are you sure that you have typed the correct hostname?
  • Are you sure that the database server is running?
  1. Tried setting up new Local site:
    Numerous error messages:
    Uh-oh! Could not update host file
    Local ran into a problem when trying to update the hosts file. Pleas ensure that the host file is not locked by anti-virus.

I’m sure I’m doing something wrong. Would appreciate some help.

Hey @rtyrell, Welcome to the Local Community Forums!

It sounds like Local is having some issues with installing alongside XAMPP. What’s likely happening is that they are both trying to use the same port on the laptop.

The error does mention something about not being able to edit the Hosts file. This usually is due to some sort of antivirus software, or security setting. Can you try temporarily disabling any antivirus software and then create a new Local site?

If that doesn’t help, Can you please provide your local-lightning.log file? See this Community Forum post for instructions on how to do so:

Note that since you are using the most recent version of Local, the file will be named local-lightning.log and not local-by-flywheel.log as is mentioned in the above FAQ.