Mysqldump to CSV

I had an issue where I need to begin refining some of our messy data for a system upgrade.

Upon my searches, I came across OpenRefine, a former Google tool that has been open sourced and seems to be an excellent option for mass updating data and cleaning up the mess.

I need to dump some of my tables into a CSV to work with them.

mysqldump -u <user> -p -T /root/ --fields-terminated-by ',' --fields-enclosed-by '"' --fields-escaped-by '\' --no-create-info <database> <table>

If you run into some issues like MYSQL stating it cannot read/write a file.

mysqldump: Got error: 1045: "Access denied for user 'root'@'localhost' (using password: YES)" when trying to connect

Make sure of 2 important things.

  1. The file permissions allow for MySQL/MariaDB to write.
  2. MySQL/MariaDB has a tmpdir variable set.


For my centos7 environment running MariaDB.
Edit /etc/my.cnf.d/server.cnf


Leave a Reply

Your email address will not be published. Required fields are marked *