Author: Brahim

MySQL import from csv

To import a local CSV file into MySQL, use the syntax below : LOAD DATA LOW_PRIORITY LOCAL INFILE ‘/path/tofile.csv’ INTO TABLE database.table FIELDS TERMINATED BY ‘;’ OPTIONALLY ENCLOSED BY ‘”‘ ESCAPED BY ‘”‘ LINES TERMINATED BY ‘\n’ IGNORE 1 LINES (`field1`,`field2`,…)

Continue Reading →

MySQL export to csv

To export a mysql results in CSV format, use the syntax below : SELECT field1, field2, … FROM table WHERE condition INTO OUTFILE ‘/tmp/toto.csv’ FIELDS TERMINATED BY ‘;’ ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘\n’ ;

Continue Reading →

Cheyenne server and POST size limit

By default, in Cheyenne, the header size limit for a post request is 102’400. If you want to ajust this limit you can define the post-mem-limit parameter in the global context or in a specific webapp. For example, to double the initial limit in the httpd.cfg, : … default [ root-dir %./www/ default [%index.html %index.rsp]

Continue Reading →

Allow invalid date in MySQL

Just in case you absolutely have to insert a date in MySQL that does’nt exist, eg 2014-02-30, you can run MySQL server in a special mode that authorizes such dates : mysqld –sql-mode=”ALLOW_INVALID_DATES” MySQL will only check that the month is in the range from 1 to 12 and the day is in the range

Continue Reading →