473,385 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

data dump

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
Dec 9 '06 #1
3 6576
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
Dec 9 '06 #2
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.
Dec 9 '06 #3
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
Dec 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Claudio Grondi | last post by:
Is there an already available script/tool able to extract records and generate proper HTML code out of the data stored in the Wikipedia SQL data base? e.g. converting all occurences of ] to <a...
6
by: NotGiven | last post by:
I have a db that I need to dump into a format that can be easily read my MS Access. I tried the dump with regular PHPAdmin. Then I used the dump to run a query in MS Access. Errors occurred...
3
by: rozrabiak | last post by:
Hi:) I need to dump data from database in to *.sql file. I try it using DUMP DATABASE but it not work that I need it. So, how can I dump data from database in to *.sql file and then run it...
11
by: Bob Hairgrove | last post by:
The following class contains start and end points of a range of values. The range can have a direction which is implied from the relative order of start and end, or it can be without direction. IOW...
7
by: Zaharije Pasalic | last post by:
I tried to implement multi-data list with a reference instead of pointer to data, but code compiled with gcc perform "segmentation fault". Generated code from other compilers: Borland C++ 5.0 and...
2
by: dotyet | last post by:
Hi Everyone, I am using db2dart to dump some sample table data in delimited format, but I am finding inconsistencies between the actual data in database table and the records dumped in .del...
3
by: Shmulik | last post by:
I have an application written in C# that creates a queue of items to process, connects via a TCP connection to a server on a Unix box, and then passes data files to the Unix box for processing...
2
by: Anony Mous | last post by:
Hi, I've seen in previous posts that recommended practice for database backup is to run the dump utility twice. Once for schema only and a second time for data only (I think). Up to know,...
1
by: TYR | last post by:
I have a large dump file that originated in a MySQL db; I need to get it into an SQLite file. Various options are suggested around the web; none of them seem to work (most failing to import the...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.