Re: export data from mysql into a text file or CSV file
how about this?
mysqldump -u$dbUser -p$dbPass --database ${DBNAME} --table ${tablename} --no-data -h ${DBHOST} > ${DBDIR}/${DBNAME}_${TYPE}/${tablename}.structure
mysql -e "select * from ${tablename};" -u$dbUser -p$dbPass -A ${DBNAME} -h ${DBHOST} -N --quick > ${DBDIR}/${DBNAME}_${TYPE}/${tablename}.data
this way the file is stored in the client not in the server and you can load them into any server you want
you can recreate table in other server like this way...
mysql -u....< ${DBDIR}/${DBNAME}_${TYPE}/${tablename}.data
and load the data
load data ....'${DBDIR}/${DBNAME}_${TYPE}/${tablename}.data' into....
_ balaji
Subject
Views
Written By
Posted
241148
April 25, 2007 08:54AM
132701
April 26, 2007 02:00PM
63599
April 27, 2007 12:54PM
40304
November 02, 2009 10:07PM
43129
July 06, 2007 03:13AM
29294
June 03, 2009 11:18PM
24668
September 01, 2009 05:32AM
31728
October 09, 2009 04:55AM
Re: export data from mysql into a text file or CSV file
21853
November 04, 2009 11:01AM
19806
October 09, 2009 05:11AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.