MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Chris McCue Date:July 11 2003 4:35pm
Subject:Re: Newbie needs help - RESOLVED
View as plain text  
I opened mysql.sql in BBEdit and ran the Zap Gremlins command, and 
there were 3+ Gremlins in front of every field name on that line. Upon 
removal of the gremlins, it reads the file fine. Weird, no?

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
> cmccue@stripped
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>
>
-- 
Thanx,
Chris McCue
cmccue@stripped

Thread
Newbie needs helpChris McCue11 Jul
  • Re: Newbie needs help - RESOLVEDChris McCue11 Jul