On Friday, July 11, 2003, at 09:32 AM, Chris McCue wrote:
I am trying to automate importing fresh data every morning. i execute
mysql -h my-domain.com -P port -u user -ppassword database_to_use < mysql.sql
at a given time, and that appears to be working. The contents of mysql.sql are
flush tables;
delete from a where id > 0;
delete from b where id > 0;
delete from c where id > 0;
delete from d where id > 0;
delete from e where id > 0;
delete from f where id > 0;
flush tables;
optimize table a, b, c, d, e, f;
load data infile '/path/to/file1.csv' REPLACE INTO TABLE a FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r' (Field1, Field2, ...);
load data infile '/path/to/file2.csv' REPLACE INTO TABLE c FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r' (Field1, Field2, ...);
load data infile '/path/to/file3.csv' REPLACE INTO TABLE d FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r' (Field1, Field2, ...);
load data infile '/path/to/file4.csv' REPLACE INTO TABLE e FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r' (Field1, Field2, ...);
flush tables;
exit
Everything works fine until it tries to execute the last load data infile. When I execute this line by copying the text and then pasting it into mysql, it works without a hitch. When i cat mysql.sql it looks fine. When I pico mysql.sql the last line is messed up with field names missing blank lines and lines with just one field name on it. Now for clarification there are 80 fields in this table. I am assuming my problem has something to do with this.
Does anyone have an idea about how I can get this to work, or another way for me to do this?
-- Thanx, Chris McCue [EMAIL PROTECTED]
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
-- Thanx, Chris McCue [EMAIL PROTECTED]
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]