# Can't log in - Error establishing a database connection

**URL:** <https://community.localwp.com/t/cant-log-in-error-establishing-a-database-connection/32216>\
**Category:** Support\
**Tags:** wordpress-login, login-local-account\
**Created:** [June 20, 2022, 6:33pm UTC](https://community.localwp.com/t/cant-log-in-error-establishing-a-database-connection/32216 "2022-06-20T18:33:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricardo\_creates](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/ricardo_creates/32/14473_2.png) [@ricardo\_creates](https://community.localwp.com/u/ricardo_creates)\
**Post date:** [June 20, 2022, 6:33pm UTC](https://community.localwp.com/t/cant-log-in-error-establishing-a-database-connection/32216/1 "2022-06-20T18:33:27Z")

</div>

### Issue Summary

Hi, so I am building a website. For now only has 4 pages, almost empty. Today I was playing with building a gallery ( I’m using Divi) all good . saved my work and left. Now I open local and press wp admin and show the error - Error establishing a database connection.  
I try to open the database adminer and says _No connection could be made because the target machine actively refused_ it when I try to log in!!  
No idea what I did as I haven’t did much on the website, except for some images and haven’t change nothing on the database.  
Any help?  
Thank you

#### System Details

- Which version of Local is being used?

- What Operating System (OS) and OS version is being used?

- Attach the Local Log. See this Help Doc for instructions on how to do so:

### Security Reminder

Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

---

<div class="post-metadata">

**Author:** ![Jrt](https://avatars.discourse-cdn.com/v4/letter/j/3e96dc/32.png) [@Jrt](https://community.localwp.com/u/Jrt)\
**Post date:** [June 21, 2022, 9:30am UTC](https://community.localwp.com/t/cant-log-in-error-establishing-a-database-connection/32216/2 "2022-06-21T09:30:31Z")

</div>

I also had the same issue. I uninstalled local and reinstalled an earlier version. That worked for me.

---

<div class="post-metadata">

**Author:** ![sambrockway](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/sambrockway/32/18726_2.png) [@sambrockway](https://community.localwp.com/u/sambrockway)\
**Post date:** [June 21, 2022, 11:14am UTC](https://community.localwp.com/t/cant-log-in-error-establishing-a-database-connection/32216/3 "2022-06-21T11:14:17Z")

</div>

Hi Ricardo! Welcome to the Local Community! 👋

Thank you for bringing your question here.

That type of error typically means something is preventing you from connecting to the port assigned to that site.

Have you tried completely closing out of Local and restarting the site?

Feel free to drop a screenshot of what you’re seeing as well to help isolate the issue.

You could also try what @Jrt suggested, although I would recommend backing up your site first. You can do that by following these steps:

> **[How to Backup a Local Site](https://localwp.com/help-docs/advanced/how-to-backup-a-local-site/)**
>
> Like other files on your computer, we recommend you backup your Local Sites to avoid data loss and protect your hard work. Click “Start Site” on your Local Site to start it. For a complete copy of…

Let me know how that all goes!

👩🏼‍💻 Sam

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/system/32/1_2.png) [@system](https://community.localwp.com/u/system)\
**Post date:** [September 19, 2022, 11:15am UTC](https://community.localwp.com/t/cant-log-in-error-establishing-a-database-connection/32216/4 "2022-09-19T11:15:03Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
