# Cannot export database using WP-CLI Access Denied

**URL:** <https://community.localwp.com/t/cannot-export-database-using-wp-cli-access-denied/45592>\
**Category:** Support\
**Tags:** mysql-8\
**Created:** [November 18, 2024, 9:27am UTC](https://community.localwp.com/t/cannot-export-database-using-wp-cli-access-denied/45592 "2024-11-18T09:27:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![clubside](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/clubside/32/15461_2.png) [@clubside](https://community.localwp.com/u/clubside)\
**Post date:** [November 18, 2024, 9:27am UTC](https://community.localwp.com/t/cannot-export-database-using-wp-cli-access-denied/45592/1 "2024-11-18T09:27:05Z")

</div>

### What issue or error are you experiencing?

Can’t export (or perform any database-related command) using WP-CLI. No problem connecting to the database with the same `wp-config.php` credentials using HeidiSQL. I have looked up any number of related issues on this forum and none are Windows-specific and the few related ones offer solutions that are unique to Linux or macOS.

* * *

### What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc

Click “Site shell” link, ensure you’re in the correct folder and enter:

```bash
wp db export --add-drop-table

```

and I get this result:

```bash
V:\dev\WordPress\icggallery\app\public>wp db export --add-drop-table
Warning: Failed to get current character set of the posts table. Reason: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect

```

* * *

### System Details

- **Local Version:**  
Version 9.1.0+6719
- **Operating System (OS) and OS version:**  
Windows 10

* * *

### Local Logs

[local-logs.zip](https://community.localwp.com/uploads/short-url/gXKpN7XFmliMwi9ORenjYoYfiBk.zip) (630.1 KB)

---

<div class="post-metadata">

**Author:** ![Nick-B](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/nick-b/32/16140_2.png) [@Nick-B](https://community.localwp.com/u/Nick-B)\
**Post date:** [November 18, 2024, 3:18pm UTC](https://community.localwp.com/t/cannot-export-database-using-wp-cli-access-denied/45592/2 "2024-11-18T15:18:47Z")

</div>

It looks like you’re using a different drive other than the default. Could there be any permissions hang ups there?

Does this happen even with a new, blank site as well?

---

<div class="post-metadata">

**Author:** ![clubside](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/clubside/32/15461_2.png) [@clubside](https://community.localwp.com/u/clubside)\
**Post date:** [November 18, 2024, 5:38pm UTC](https://community.localwp.com/t/cannot-export-database-using-wp-cli-access-denied/45592/3 "2024-11-18T17:38:35Z")

</div>

I’m not sure why the drive letter/folder location would matter when the error is happening when trying to access the database. I have no problem accessing the database from HeidiSQL or node.js (I am writing an app to port an old Omeka Classic site to WordPress) nor installing plugins or uploading media which I assume require the permissions you mentioned.

---

<div class="post-metadata">

**Author:** ![Nick-B](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/nick-b/32/16140_2.png) [@Nick-B](https://community.localwp.com/u/Nick-B)\
**Post date:** [November 18, 2024, 5:45pm UTC](https://community.localwp.com/t/cannot-export-database-using-wp-cli-access-denied/45592/4 "2024-11-18T17:45:11Z")

</div>

It was just a thought @clubside but I’m glad most everything is working for you normally. So does this happen for every site you try including a new, blank site? Or is it just the specific site you’re working on currently?

---

<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:** [February 16, 2025, 5:45pm UTC](https://community.localwp.com/t/cannot-export-database-using-wp-cli-access-denied/45592/5 "2025-02-16T17:45:40Z")

</div>

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