data dump
am 09.12.2006 14:04:00 von Ike
Here's a dumb question, but I am unable to find the relevant spot in the
online docs, and am coming to the group asking my (pathetically) little dumb
question (which I should know the answer to!)
I can take data into a database from an sql file with:
mysql -u USER -p DBNAME < dump.sql
But how do I send data out of an sql table, to an sql-type text file? Don't
I simple change the redirection symbol from "less than," to "greater to," as
follows:
mysql -u USER -p DBNAME > dump.sql
Whenever I do this, however, it just hangs (even on tiny databases, so I
must have something syntactically wrong here). Can anyone point me in the
right direction on this please? Thanks, Ike
Re: data dump
am 10.12.2006 00:55:15 von Aggro
Ike wrote:
> I can take data into a database from an sql file with:
>
> mysql -u USER -p DBNAME < dump.sql
>
> But how do I send data out of an sql table, to an sql-type text file? Don't
> I simple change the redirection symbol from "less than," to "greater to," as
> follows:
>
> mysql -u USER -p DBNAME > dump.sql
No, you will use another program for that purpose:
mysqldump -u USER -p DBNAME > dump.sql
Re: data dump
am 10.12.2006 00:57:02 von Aggro
Aggro wrote:
> No, you will use another program for that purpose:
>
> mysqldump -u USER -p DBNAME > dump.sql
If you wonder why. The program itself has no way of knowing that you
placed > after the command. It would do the same thing even if you don't
put it. So if you try:
mysqldump -u USER -p DBNAME
It will just print out the dump on the screen, instead of the file. This
is why another command must be used for this purpose.
Re: data dump
am 10.12.2006 18:02:19 von Michael Austin
Aggro wrote:
> Ike wrote:
>
>> I can take data into a database from an sql file with:
>>
>> mysql -u USER -p DBNAME < dump.sql
>>
>> But how do I send data out of an sql table, to an sql-type text file?
>> Don't I simple change the redirection symbol from "less than," to
>> "greater to," as follows:
>>
>> mysql -u USER -p DBNAME > dump.sql
>
>
> No, you will use another program for that purpose:
>
> mysqldump -u USER -p DBNAME > dump.sql
What format do you want the data to be in? do you want something that looks
like the actual insert statement or do you just want the data (delimited or
concatenated...) you have not give us much information to go on.
"mysqldump" is used to extract the database structure as well as the insert
statements for the data in the database - not data only. I find mysqldump to
quite archaic in its implementation. A real database engine that I am familiar
with has the ability to un
again, what do you want to achieve? what is the problem you are trying to solve?
--
Michael Austin.
Database Consultant