Event - how to load data infile using windows tasks

08/03/2013

program: "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysql.exe"
arguments: "-uroot" "-ppasword12*" "-eSOURCE c:/loadquery.sql"

Using Batch

cd C:\inetpub\wwwroot\folderScript
start php.exe -f C:\inetpub\wwwroot\folderScript\somescript.php

How to set password on phpmyadmin

20/02/2013


C:\xampp\phpmyadmin\config.inc.php

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

chartset UTF-8

20/11/2012

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


        @mysql_query('SET NAMES "utf8"');
        @mysql_query('SET CHARACTER SET utf8');
        @mysql_query('SET COLLATION_CONNECTION = "utf8_general_ci"');



Ficheiros, guarda como "UTF-8 without BOM", e o encoding do html deixa como utf-8.

Load .csv into MySQL

15/11/2012


LOAD DATA INFILE 'data.txt' INTO TABLE test.lgmweb
  FIELDS TERMINATED BY ',' ENCLOSED BY '"'
  LINES TERMINATED BY '\r\n'
  IGNORE 1 LINES;

Import excel to mysql via phpMyAdmin

07/04/2012

Some considerations to make: 

- If you have an id column as primary key you should set the first row of that column to 'NULL' i.e. just to reserve the space for the index on mysql.

- Columns should match in number and in field type.

- Csv file does not need column headers.

- If the structure between your csv file and mysql  structure doesn't match,  you must respect the structure of mysql table, for that you must include columns (if needed) and type some value (depending of field type).