user1250526
user1250526

Reputation: 309

PHP Mysql - exporting whole database

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

Answers (3)

Crsr
Crsr

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

Crashspeeder
Crashspeeder

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

hohner
hohner

Reputation: 11588

phpMyAdmin is your friend.

Upvotes: 3

Related Questions