MySQL Forums
Forum List  »  Other Migration

Re: export data from mysql into a text file or CSV file
Posted by: Balaji Devarajan
Date: November 04, 2009 11:01AM

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

Options: ReplyQuote


Subject
Views
Written By
Posted
24133
September 01, 2009 05:32AM
Re: export data from mysql into a text file or CSV file
21046
November 04, 2009 11:01AM


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.