How to convert MySQL data in CSV
Site backup is the most important point. and MySQL provides to .sql file and another file to you can create a backup. MySQL data convert in CSV to two way first yourdomai.com/phpmyadmin and export button to export .sql,.csv, etc format download. but some reason to not open yourdomai.com/phpmyadmin and you can get back up. so you can create a MySQL command line to database backup get. In this tutorials How to convert MySQL data in CSV with MySQL command line file.
Access MySQL
Now, open terminal and run the bellow command :
$ mysql -u root -p
And enter your password.
Show database
$ show databases;
Select table
$ use table_name;
Create mysql query
MySQL SELECT query to SELECT all data in the MySQL database.
The CSV is four options in the MySQL command line:
FIELDS TERMINATED BY: The character used between fields.
ENCLOSED BY: The character that surrounds each value.
ESCAPED BY: The character that prefixes non-printable characters.
LINES TERMINATED BY: The new-line character.
Example
SELECT id, f_name, email FROM members INTO OUTFILE '/var/lib/mysql-files/member_export.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
OR
SELECT id, f_name, email INTO OUTFILE '/var/lib/mysql-files/export_member.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY ',' LINES TERMINATED BY '\n' FROM members;