Page 1 of 1

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

Posted: Tue Aug 08, 2006 4:42 pm
by Judland
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?

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

Posted: Mon Aug 14, 2006 9:18 am
by Gomer_X
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.

Posted: Mon Aug 14, 2006 3:09 pm
by Judland
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?

Posted: Tue Aug 15, 2006 8:34 am
by yeti
try something like:

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

Posted: Tue Aug 15, 2006 10:08 am
by dann
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.

Posted: Tue Aug 15, 2006 12:42 pm
by Judland
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!