I know there are a lot of places where you can probably find the code below, but instead of having to look it up again the next time I have to use it, I thought it'd be handy to just add it here as a how-to item.

The code uses the primary admin account which comes default with Plesk, and uses a snippet to pull in the password automatically, then the database name is specified along with a filename for the exported database.

On newer Plesk versions it seems the phpMyAdmin importing is a lot more robust (larger file sizes and execution times) you can then take the exported file and import it using phpMyAdmin into a new Plesk server (if you're migrating from an older Plesk version as I was).

/usr/bin/mysqldump --user=admin --password=`/bin/cat /etc/psa/.psa.shadow` mydatabasename > myexportfile.sql