I’m attempting to upload an error_log file into a MySQL table.
The contents of the file are
2010-03-20 13:00:22|1024|Testing My Error Handler!|C:\\wamp\\www\\Framework\\framework\\index.php|5
2010-03-20 13:00:25|1024|Testing My Error Handler!|C:\\wamp\\www\\Framework\\framework\\index.php|5
2010-03-20 13:00:27|1024|Testing My Error Handler!|C:\\wamp\\www\\Framework\\framework\\index.php|5
The MySQL Query I am executing is…
LOAD DATE INFILE 'c:/wamp/framework_logs/error_log.php'
INTO TABLE Error_Log
FIELDS TERMINATED BY '|'
LINES TERMINATED BY '\\r\
'
(date, number, message, file, line);
When I executed this query everything is loaded properly into the table, except for the first item in the first row of the log file.
MySQL gives me the following warning: “Out of range value for column ‘date’ at row 1”
When I run “SELECT date from Error_Log” I can see that for the first row in the table, it just inserted 0000-00-00 00:00:00 instead of 2010-03-20 13:00:22. However, it got the second and third dates correct.
I thought it might be a file encoding issue, but the file is saved in ‘UTF8’ which is what I also using in MySQL.
Anyone have any ideas of what might be causing the first date not to be inserted properly?