Interaction with mysql in shell script 1:
[Plain] mysqlCMD = "mysql-h $ {MYSQL_HOST}-P $ {MYSQL_PORT}-u $ {MYSQL_USER}-p $ {MYSQL_PASS}" create_table_ SQL = "CREATE TABLE IF NOT EXISTS $ {MYSQL_DB_NAME }. $ {access_table_name} (id INT (10) not null AUTO_INCREMENT, accId INT (10) not null, url int (10) not null ,.... primary key (id), index url (URL) COLLATE = 'utf8 _ general_ci 'ENGINE = MyISAM ROW_FORMAT = DEFAULT AUTO_INCREMENT = 1 "empty_table_ SQL =" TRUNCATE $ {MYSQL_DB_NAME }. $ {table_name} "echo $ create_table_ SQL | $ {mysqlCMD} echo $ empty_table_ SQL |$ {mysqlCMD}
Insert and other operations are the same:
[Plain] loadsql = "load data LOW_PRIORITY local infile '$ {LOG_TEMP}' into table $ {MYSQL_DB_NAME }. $ {table_name} fields terminated by '& 'Lines terminated by' \ n' (id, URL .....); "mysql-h $ {MYSQL_HOST}-P $ {MYSQL_PORT}-u $ {MYSQL_USER}-p' $ {MYSQL_PASS} '-N-e" $ {loadsql} "insert, etc. same operation