Help! I need to "talk" with a MySQL Wizard!

Hey drop us a line about the show. Feel free to ask questions, provide feedback and criticism, or just ramble on about anything your little heart desires.

Moderators: snarkout, Patrick, dann

Post Reply
Judland
Posts: 1030
Joined: Tue Apr 27, 2004 12:55 pm

Help! I need to "talk" with a MySQL Wizard!

Post by Judland » Tue Aug 08, 2006 4:42 pm

I've got a little project going, here where I work, and I need a little bit of help with MySQL.

This is an opportunity to make some inroads for Linux and open source software in the company, if I can get this one task to work.

Anybody here (or know of) a wizard with MySQL that wouldn't mind giving me some advice?

User avatar
Gomer_X
Posts: 901
Joined: Fri Jun 03, 2005 1:31 pm
Location: Cincinnati, Ohio, USA
Contact:

Re: Help! I need to "talk" with a MySQL Wizard!

Post by Gomer_X » Mon Aug 14, 2006 9:18 am

Judland wrote:I've got a little project going, here where I work, and I need a little bit of help with MySQL.

This is an opportunity to make some inroads for Linux and open source software in the company, if I can get this one task to work.

Anybody here (or know of) a wizard with MySQL that wouldn't mind giving me some advice?
What do you need? I'm not a wizard, but I know SQL more or less, and have MySQL running on my server.

Usually it's a matter of dealing with some frontend to MySQL rather than MySQL itself, unless you're talking about writing your own software. I use the mysql shell, and a little Perl.

Hopefully somebody here can help if you let us know what you need.

Judland
Posts: 1030
Joined: Tue Apr 27, 2004 12:55 pm

Post by Judland » Mon Aug 14, 2006 3:09 pm

The particulars:

I've setup an eGroupWare server at the office on this Linux box hidden (away from the office IT guys) under my desk.

We have this internal accounting system that I want to export data from (in a CSV file most likely) and import this into one of the MySQL databases existing in the eGroupWare system.

This is project information that I'd rather not have to re-type from one system to the other.

If I can show my manager that someone would be able to easily take data from our exisiting system and import the basics of it into the eGroupWare system, it would be a much easier sell for me.

How difficult is it to import CSV (suggestions for easier methods of importing accepted) into a MySQL database? What would I need to do, or where could I go on the Net to learn how to do this sort of thing?

User avatar
yeti
Posts: 21
Joined: Tue Aug 08, 2006 3:45 pm
Location: Londinium

Post by yeti » Tue Aug 15, 2006 8:34 am

try something like:

LOAD DATA INFILE '/tmp/myfile.csv' INTO TABLE mytable FIELDS TERMINATED BY ',' IGNORE 1 LINES

User avatar
dann
Site Admin
Posts: 1132
Joined: Mon Apr 26, 2004 10:55 pm
Location: Hampton, Va, USA
Contact:

Post by dann » Tue Aug 15, 2006 10:08 am

yeti wrote:try something like:

LOAD DATA INFILE '/tmp/myfile.csv' INTO TABLE mytable FIELDS TERMINATED BY ',' IGNORE 1 LINES
You can also use mysqlimport from a shell.

mysqlimport --local=1 --fields-terminated=, -c field1,field2,... -u yourname -p -h yourhost yourdatabase yourimportfile

One of the limitations is that the import file must be named the same as the table you are importing into.

Judland
Posts: 1030
Joined: Tue Apr 27, 2004 12:55 pm

Post by Judland » Tue Aug 15, 2006 12:42 pm

yeti wrote:try something like:

LOAD DATA INFILE '/tmp/myfile.csv' INTO TABLE mytable FIELDS TERMINATED BY ',' IGNORE 1 LINES
Thanks, everybody, for the replies and the help.

This worked like a charm! Now I'm armed with a tool that is sure to silence a few nay-sayers.

Now, I'm off to work on the presentation portion of this project.

Thanks again!

Post Reply