WP-CLI db export still doesn't work

What issue or error are you experiencing?

I opened the same topic long ago and it was never resolved forcing me to use HeidiSQL to write out a dump and then import it with phpMyAdmin on my host. This is much more frustrating as you have to customize the output to drop tables, etc. I don’t understand how this is even an issue as all the support articles mention adding the database user and password to the commandline but that has no effect the problem is related to how mysqldump accesses the MariaDB instance created by Local. Here is the output:

V:\dev\WordPress\verisimilitude\app\public>wp db export
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

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

Click on “Site shell” from the Local site panel. Change to directory of install (in my case V:\dev\WordPress\verisimilitude\app\public) and type wb db export


System Details

  • Local Version: Version 9.2.5+6810

  • Operating System (OS) and OS version: Windows 10


Local Logs

Attach

local-lightning.log (363.4 KB)

your Local Logs here (Help Doc - Retrieving Local’s Log)


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.

Hi, @clubside. If you pass --defaults after opening a site shell and changing to your site directory, does export work?

wp db export --defaults

That should ensure custom ports and your character set get passed to mysqldump by WP-CLI, which might clear your ‘Failed to get current character set of the posts table’ error.

(Normally you should not have to change directory after opening a site shell, by the way, this seems to be a bug in Local related to you storing this site on a non-C drive, as @Nick-B suspected in your original post. I can report this to the team to look into.)