You are here

MySQL mysqlimport examples

see: http://dev.mysql.com/doc/refman/5.0/en/mysqlimport.html
and also: http://dev.mysql.com/doc/refman/5.0/en/load-data.html

mysqlimport [options] db_name textfile1 [textfile2 ...]

cd "C:\Program Files\MySQL\MySQL Server 5.0\bin"
mysql -u root -p -e "CREATE TABLE temp_email(name VARCHAR(200), email VARCHAR(50) PRIMARY KEY)" cfaw
mysqlimport -u root -p --lines-terminated-by="\r\n" cfaw c:\temp\temp_email.tsv

Campaignmonitor.com subscribers can be downloaded as TSVs from the subscriber page
-needs separate downloads for bounces and unsubs
-must edit and remove the top line and the " characters

Drupal import

There is a problem that uploaded tables are in the wrong characterset for Drupal.
To modify a Drupal content table from an uploaded table (tempets) --here is an example:
UPDATE content_type_paper c
JOIN tempets t
ON cast(c.field_pid_value as CHAR CHARACTER SET utf8) = cast(t.id as CHAR CHARACTER SET utf8)
SET c.field_audio_url = CONCAT('http://l1nk.org/audio/',cast(t.filename as CHAR CHARACTER SET utf8)),
field_audio_attributes = 'a:0:{}';