# Error establish a database connection

**URL:** <https://community.localwp.com/t/error-establish-a-database-connection/30319>\
**Category:** Support\
**Created:** [February 15, 2022, 3:18pm UTC](https://community.localwp.com/t/error-establish-a-database-connection/30319 "2022-02-15T15:18:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gebrolto](https://avatars.discourse-cdn.com/v4/letter/g/91b2a8/32.png) [@gebrolto](https://community.localwp.com/u/gebrolto)\
**Post date:** [February 15, 2022, 3:18pm UTC](https://community.localwp.com/t/error-establish-a-database-connection/30319/1 "2022-02-15T15:18:35Z")

</div>

### Issue Summary

When I try to access my site, I get the message “error establishing a database connection.” This may have happened when my mac crashed, as that’s been happening lately with my machine and I see a few other posters have had that same issue.

I’m using macOS Monterey version 12.01 and Local version 6.3.

Unfortunately I don’t have a backup of my site, so I tried following the steps here  
([Import/Export a WordPress Site - Local](https://localwp.com/help-docs/getting-started/how-to-import-a-wordpress-site-into-local/)) to import a site from my local files onto a new site. When I did that I got the error message: local was unable to import the following SQL files:  
(then no files were listed)

Here are my local logs:  
[local-logs.zip](https://community.localwp.com/uploads/short-url/3hDpsmqz5NGoVG9sCRQJaQeK21N.zip) (348.7 KB)

#### Troubleshooting Questions

Only occurs for one of my local sites. The rest still work fine.

I’m able to create a new plain Wordpress site on local.

---

<div class="post-metadata">

**Author:** ![gebrolto](https://avatars.discourse-cdn.com/v4/letter/g/91b2a8/32.png) [@gebrolto](https://community.localwp.com/u/gebrolto)\
**Post date:** [February 16, 2022, 1:51pm UTC](https://community.localwp.com/t/error-establish-a-database-connection/30319/2 "2022-02-16T13:51:09Z")

</div>

Hey there I would love any help if possible!

---

<div class="post-metadata">

**Author:** ![hbcondo](https://avatars.discourse-cdn.com/v4/letter/h/41988e/32.png) [@hbcondo](https://community.localwp.com/u/hbcondo)\
**Post date:** [February 16, 2022, 7:07pm UTC](https://community.localwp.com/t/error-establish-a-database-connection/30319/3 "2022-02-16T19:07:14Z")

</div>

Just upgraded to v6.3.0+5756 (from v6.2) and get a database error too when attempting to launch my WP site:

`Fatal error: Uncaught Error: Call to undefined function mysql_connect() in c:\source\repos\WordPress\app\public\wp-includes\wp-db.php:1688 Stack trace: #0 c:\source\repos\WordPress\app\public\wp-includes\wp-db.php(632): wpdb->db_connect() #1 c:\source\repos\WordPress\app\public\wp-includes\load.php(558): wpdb->__construct('root', 'root', 'local', 'localhost') #2 c:\source\repos\WordPress\app\public\wp-settings.php(124): require_wp_db() #3 c:\source\repos\WordPress\app\public\wp-config.php(93): require_once('C:\\Users\\s...') #4 c:\source\repos\WordPress\app\public\wp-load.php(50): require_once('C:\\Users\\s...') #5 c:\source\repos\WordPress\app\public\wp-blog-header.php(13): require_once('C:\\s...') #6 c:\source\repos\WordPress\app\public\index.php(17): require('C:\\s...') #7 {main} thrown in c:\source\repos\WordPress\app\public\wp-includes\wp-db.php on line 1688`

**Never experienced this issue before but Adminer still works.**

---

<div class="post-metadata">

**Author:** ![hbcondo](https://avatars.discourse-cdn.com/v4/letter/h/41988e/32.png) [@hbcondo](https://community.localwp.com/u/hbcondo)\
**Post date:** [February 16, 2022, 7:37pm UTC](https://community.localwp.com/t/error-establish-a-database-connection/30319/4 "2022-02-16T19:37:22Z")

</div>

Having db connection errors too after upgrading to v6.3. I posted the exception details but it got flagged as spam so I’m reposting w/o it.

---

<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:** [May 17, 2022, 7:37pm UTC](https://community.localwp.com/t/error-establish-a-database-connection/30319/5 "2022-05-17T19:37:34Z")

</div>

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