Reputation: 309
I would like the administrator on my website to give the option to export the whole database of the website on one click, just a simple submit button which will save the database in .csv or sql to the PC, is this possible at all?
Upvotes: 0
Views: 577
Reputation: 624
SELECT * INTO OUTFILE 'your_table.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM your_table
Or use navicat (software) good luck
Thanks @Crashspeeder
mysqldump database_name > database_name.sql
navicat tool remains a solution
Upvotes: 0
Reputation: 4311
One option would be to stream the output of the mysqldump
command using passthru. If you set the proper headers the output can be downloadable.
Upvotes: 2