If you have Ruby, you can install the mysql2xxxx gem (not the mysql2json gem, which is a different gem):
$ gem install mysql2xxxx
and then run the command
$ mysql2json --user=root --password=password --database=database_name --execute "select * from mytable" >mytable.json
The gem also provides mysql2csv
and mysql2xml
. It’s not as fast as mysqldump, but also doesn’t suffer from some of mysqldump’s weirdnesses (like only being able to dump CSV from the same computer as the MySQL server itself)