Mindbend.org

Mindblog

Welcome to my Blog!

Techblog

Information should be free, accurate, and available. I will be updating this section most often, enjoy!

Portfolio

Various galleries of artwork and photography I have done over the last five years.

Scripts

Mini scripts I have written and decided to share. Mostly oneliners for managing network and system load.

Mindware

Software projects are in the works and will be here eventually!

Contact

You can contact me through various methods.

Importing Mysql Files

This is a quick guide to importing Mysql flat files into a database.

Importing the data

Connecting to the database and importing from mysqldump files

$ mysql -u dbuser -pPassword -o < dbfile.sql
$

As long as the .sql file is formatted with commands, the previous line will work just fine. This allows you to simply execute the lines of code from within the file. But what if the file is a CSV file?

$ mysql -u dbuser -pPassword
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 172

mysql> load data local infile 'dbfile.txt' 
   -> into table tblproducts fields terminated by '\t'
   -> lines terminated by '\n';

This will import the data into the table organized by tabs seperated by new lines.

Written by:Robert Church
Published on:06-06-2009

Quick Byte

No committee could ever come up with anything as revolutionary as a
camel--anything as practical and as perfectly designed to perform
effectively under such difficult conditions.
-- Laurence J. Peter, presumably responding to the joke that a
camel is a horse designed by committee.