MySQL table exporting and importing using a file - without phpMyAdmin?
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开发者_如何学Python PHP functions should I be taking a look at?
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.
Use mysqldump
mysqldump -u username -ppassword -h hostname database_name > db_name_backup.sql
Mysqldump documentation is here
精彩评论