Reputation: 3025
It'd be nice if I could request a backup file (such as a .sql or .csv) for my MySQL table through my site, so I would be able to 'reset' the table in case anything goes wrong. These two actions, exporting and importing, are explained here, but in my case it'd be much better if this could be done via a web interface of some kind, without accessing phpMyAdmin directly. Is this possible? If so, what PHP functions should I be taking a look at?
Upvotes: 1
Views: 1151
Reputation: 8240
Use mysqldump
mysqldump -u username -ppassword -h hostname database_name > db_name_backup.sql
Mysqldump documentation is here
Upvotes: 1
Reputation: 1336
See this MySQL doc page and look for the INTO OUTFILE
option that allows you to write your results directly to a file without even reading them from PHP.
Upvotes: 2