I am not sure if you are running XAMPP on a PC, Mac, or Linux system?
I am not sure how you are trying to export the database. Can you give us more details?
The reason why I ask is that I have had success exporting the database running XAMPP on both a PC and Mac.
Maybe Tony's post will help.
I use nearly the same form of this command. From Terminial on my Mac (for MAMP, but XAMPP is the same), it looks like:
rjerz$ /Applications/MAMP/Library/bin/mysqldump -uroot -p[password] --opt -rmoodledb.sql [moodle_database_name]