简体   繁体   中英

PHP Mysql - exporting whole database

我希望我网站的管理员可以选择一次导出网站的整个数据库,只是一个简单的提交按钮,它将数据库以.csv或sql格式保存到PC上,这有可能吗?

phpMyAdmin是您的朋友。

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM