[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exporting mysql table into csv file



Yeah that should work unless you use different usernames and passwords
for mysql than unix then you need to use the -u and --password options
there.  Good luck charles.

Bob T. Kat

"We demand rigidly defined areas of doubt and uncertainty." 
  - Douglas Adams -

-----Original Message-----
From: luci-discuss-owner@luci.org [mailto:luci-discuss-owner@luci.org]
On Behalf Of Justin R. Meats
Sent: Wednesday, September 25, 2002 5:23 PM
To: luci-discuss@luci.org
Subject: Re: exporting mysql table into csv file


The -T needs to be followed by the directory name for the output file.

i.e.
 mysqldump -T directory_to_place_output --fields-terminated-by=','
db_name
table_name

that command would create the following two files:

directory_to_place_output/table_name.txt - The text output
directory_to_place_output/table_name.sql - The SQL to create the table

if you want quotes around the fields try this:
mysqldump -T
directory_to_place_output --fields-enclosed-by='"'
--fields-terminated-by=',
' db_name table_name

The above commands seemed to work for me.

Justin R. Meats
(217) 221-0664
justin@internetpartners.com
http://www.internetpartners.com


-----Original Message-----
From: luci-discuss-owner@luci.org [mailto:luci-discuss-owner@luci.org]On
Behalf Of Charles Menzes
Sent: Wednesday, September 25, 2002 5:08 PM
To: luci-discuss@luci.org
Subject: Re: exporting mysql table into csv file


I'm dealing with some fairly large tables, so I'd like to just use a
cron'd mysqldump routine to create the .txt file that can be statically
linked to using an ssl encrypted and htaccess protected webpage.

 mysqldump -T --fields-terminated-by=',' db_name table_name

I'm guessing that my -T field is missing some param, but I'm not sure
what. The option name, --tab, doesnt really imply anything to me, but
I'm
new to databases. I'm just using it to shove data pulled via snmp into.

I need a csv file so that I can allow other users to import the data
into
excel or access databases.

thanks -c

On Wed, 25 Sep 2002, Benjamin Story wrote:

> I've never used mysqldump, but phpmyadmin does a nice job of this.
> On Wed, Sep 25, 2002 at 03:59:53PM -0500, Charles Menzes wrote:
> > I've been struggling all afternoon with trying to get a table's
contents
> > exported into a csv file using mysqldump. Can anyone give me proper
syntax
> > to do this? I keep trying various combinations of
--fields-terminated-by
> > and --fields-escaped-by, but to no luck.
> >
> > Any help is appreciated.
> >
> > Thanks -c
> >
> >
> > -
> > To unsubscribe, send email to majordomo@luci.org with
> > "unsubscribe luci-discuss" in the body.
>
>


-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.



-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.


-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.