load-data-infile

No SQL Query results after successful CSV import in mysql using LOAD DATA LOCAL INFILE

ε祈祈猫儿з 提交于 2020-01-24 14:20:05
问题 I am facing a strange problem after successfully importing the contents of a .csv file in mysql db. The data from the csv file is imported into the db table successfully but no query results are returned if i run any SQL query with a Condition on on the table. I am able to run the query : select * from mst_question but no results are returned if a condition is specified and the condition is met select * from mst_question where qtype='single' The table is having rows where the column qtype

What file and directory permissions are required for MySQL LOAD DATA INFILE?

空扰寡人 提交于 2020-01-20 04:11:05
问题 I have a script that is trying to load some data into MySQL with LOAD DATA INFILE . For some reason, it works if the file is in the /tmp directory, but not if the file is in another directory with identical permissions. I can't find any way to get MySQL to import data from outside the /tmp directory, or the database directory, but I can't find anything in the manual that explains why this would be the case. The situation: $ ls -l / ... drwxrwxrwt 21 root root 4096 2010-10-19 20:02 tmp

mysql duplicates with LOAD DATA INFILE

大城市里の小女人 提交于 2020-01-09 11:25:06
问题 When using LOAD DATA INFILE, is there a way to either flag a duplicate row, or dump any/all duplicates into a separate table? 回答1: From the LOAD DATE INFILE documentation: The REPLACE and IGNORE keywords control handling of input rows that duplicate existing rows on unique key values: If you specify REPLACE, input rows replace existing rows. In other words, rows that have the same value for a primary key or unique index as an existing row. See Section 12.2.7, “REPLACE Syntax”. If you specify

The used command is not allowed with this MySQL version

守給你的承諾、 提交于 2020-01-07 06:48:08
问题 Alright, so after a week of trying all the different ideas answers I have found with no success, I am going to ask. This is for the LOAD DATA LOCAL INFILE, for MySQL. There have been many posts regarding this, but I am still unable to get it work from the web browser, but am able to run it from the mysql command prompt on the server, with the same user and pass connecting to the same database. What I have tried so far MySQL version 5.5 Ubuntu 12.04 PHP version 5.3 In my.cnf local-infile=1 in

More than 60 seconds or minutes in MySQL import file

隐身守侯 提交于 2020-01-06 03:41:29
问题 I'm currently importing a CSV file to a MySQL table, with lines like: 2/28/2015 8:46:30 PM,1:40,2,1234567,1435.6071 2/28/2015 8:45:58 PM,0:19,1,1234568,1435.6436 It's basically a CDR from a PBX. However, I don't have control of info source, so I just receive this file as is. So far, columns are: DATE,DURATION,MINUTES,PHONE,BALANCE I've used LOAD DATA INFILE to import my data, like this: LOAD DATA INFILE '10811.csv' INTO TABLE cdr fields terminated by ',' lines terminated by '\n' (@col1, @col2

Why can't I use LOAD DATA LOCAL with PDO even though I can from cli client?

拈花ヽ惹草 提交于 2019-12-29 06:30:12
问题 I recently upgraded my Ubuntu 10.04 dev server to 14.04. It is actually a fresh install. PHP version was 5.4.15, and is now PHP 5.5.9. MySQL went from 5.1.67 to 5.5.37. I am trying to LOAD LOCAL DATA INFILE on a new server. It works running the command using the local mysql cli client. It does not work when executing using PDO: PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1148 The used command is not allowed with this

Cannot get Load Data Infile To Work

a 夏天 提交于 2019-12-25 05:33:12
问题 Here is my LOAD DATA script. I cannot get it to work. Any one have any heads up on what I can do? Thanks! $sql = " LOAD DATA INFILE ".$theFile." REPLACE INTO TABLE Product FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n' (archived_id_number, sku, name, upc, account_id, shippingBox_id, unit_cost, supplier_id, description, productLength, productWidth, productHeight)"; Here is what and example of my txt file(s) looks like: 43485|7850|Cool Circuits|630227078508|74||10.00|545||0.00|0.00|0.00

load data infile with counting duplicate rows in mysql

陌路散爱 提交于 2019-12-25 02:25:53
问题 I have a single column csv file containing duplicate records. I have more than ten thousands records.So I am using LOAD DATA LOCAL INFILE Example data: ID 1 2 3 2 2 1 2 The mysql table is called 'huts'. My first question is if it is possible to count how many duplicate rows are there for each row while inserting the data in mysql table 'huts'.So I would like to see the populated huts table as below ID count 1 2 2 4 3 1 My second question is if the above is not possible then my current working

Importing Data from CSV file into MySQL, Scientific Notation

試著忘記壹切 提交于 2019-12-24 17:43:37
问题 I am using a LOAD DATA INFILE to read from a CSV and insert into a MySQL table. The problem is that one column in the CSV is in scientific notation and when it is read and loaded into the table it won't go into a column of type DOUBLE, FLOAT, or REAL. Is there a solution to this? 114,2015-05-11 00:00:00.000,0,100,14,2.576927E+10,1.730594E+10,1.904524E+10,1.788426E+10,69.40149 In this one row of the CSV are the scientific notation values that when loaded via LOAD DATA INFILE just become 100000

What is the best way to periodically load data into table

雨燕双飞 提交于 2019-12-24 11:29:31
问题 I have a database with static tables which require to be updated from CSV weekly. Tables are Mysql MyISAM and by static i mean they are used for read only (except when updated from CVS, obviously). There're about 50 tables and in total about 200mb of data to be reloaded weekly. I can think about 3 ways: Truncate table Load data from files Or For each table create a temporary table Load data there Truncate (or delete rows?) original table Insert into original table select * from temporary