Page 1 of 1
How to export mysql database to text file?
Posted: Sun Jan 16, 2005 11:14 pm
by hoanghuy
i want export mysql database to text file,
please help me.
Thanks.
Posted: Sun Jan 16, 2005 11:17 pm
by feyd
phpMyAdmin is a very good tool that supports this in many formats.
What format do you want to export the database to? SQL, CSV, Tabbed, something else?
Posted: Mon Jan 17, 2005 1:34 am
by hoanghuy
feyd wrote:phpMyAdmin is a very good tool that supports this in many formats.
What format do you want to export the database to? SQL, CSV, Tabbed, something else?
I want back up automatically and user can't use phpMyAdmin
I want to write it by code.
Posted: Mon Jan 17, 2005 1:51 am
by feyd
there's a facility in MySQL itself to export the data of a table:
http://dev.mysql.com/doc/mysql/en/SELECT.html read the SELECT ... INTO OUTFILE parts.
You may have access to exec() and so could run:
http://dev.mysql.com/doc/mysql/en/mysqldump.html
The manual way is slightly more complex, in that you have to get the table's structure, and re-engineer the query to create it.. then fetch all the rows and create insert queries for each of those as well.
We've talked about getting the table structure a little bit, recently:
viewtopic.php?t=29183