Here is a little php script that you can use to export MySQL data to CSV  :

!/usr/bin/php -q

You can then run the script as :

php /path/to/phpScript.php