Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




Import A Text File


I have a utf8 txt file to import in a MySQL db, cause I must create a
web-application in PHP for reading this information on-line.
I have create a new DB in MYSQL 4.1.1a setting CHARACTER=utf8,
then I have create a table t1 with character set utf8 and some fileds
also with CHARACTER=utf8.
Then I imported the Txt file (really in UTF8 format, with 22600
records!) in my db. MySQL have imported the non-utf8 field correctly,
26000 records.
When I try to read this utf8 filed they appear like "???-?-???".
Then, also my PHP application show this field with stranges
characters. I have try also with PHPfunction utf8_encode with no
success




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Import Text File?
I am using MAMP and am trying to import a large text file (up to 30mb) that is defined by position i.e., space 1-8 = ID, space 9-14 = Description, etc. The only option for import is via SQL or CSV file.

Text File Import
I'm importing a large text file (8 million lines) into a mysql table via the heidisql front end. Each line has 42 fields (tab separated) so there's a lot of data to bring in.

I tested the import with a truncated version of the text file (10,000 lines) and the import worked fine. It took about a minute (i think) to import. Now though, the full version (which is 800x as long) has been importing for nearly 48 hours. Heidisql seems to be still working - it hasn't frozen, it's busy.

Is it normal for a file of this size to take so long to import?

Import Text And Csv File
i want to import either text or csv file to database how can i do this..i have tried mysqlimport command but its giving some error

MySQL Import Text File Too Big?
Our production database in an exported textfil runs about 60 MB.
Compressed that's about 9 MB.

I'm trying to import the export into another machine running FC3 and
mySQL 11.18, and it appears as though the file may be too big!
When I try to do it via command line:

mysql -u root --host=localhost printing < ./printing.txt

It eventually errors out with a "syntax error on line X" and only about
half the tables get imported, and MyPHPAdmin GUI interface says it has
a 2MB file limit on importing.

This concerns me. If something were to happen to our production
database, how am I going to restore it?

I tried to do a search on mysql.com, but that's a less than helpful
site for support. A newsgroup search on the topic didn't come up with
much, so maybe I'm just bad at using keywords.

Data Import From Text File
When I try to import a text file with new data for an existing
table I get the error "1148 - the used command is not allowed
with this MySQL version."

I have tried with both PHPMyAdmin2.3 and with MySQLFront 2.5.
Both these GUI programmes have an "import from text file" command
which I have used successfully several times to add entries to
this table before - running just this MySQL version. I have
structured the data in the text file in just the same format as
previously.

Both these programmes are connecting to the database successfully
now and will display the contents of the existing table data and
strcutre of the database etc (despite an earlier connection
problem which seems to have been solved spontaneously).

But both now deliver exactly this error message (and therefore I
assume it is MySQL and not the interface programmes which is
doing it).I cannot see that I am doing anything different.

I have MySQL 4.0.12 on Windows ME PC with a local Apache server
and PHP.

Error In Mysql Import (text File)
Error

SQL query:

-- phpMyAdmin SQL Dump
-- version 2.8.0.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: May 27, 2006 at 12:21 AM
-- Server version: 4.1.18
-- PHP Version: 4.4.2
--
-- Database: `lopata_trnew`
--
-- --------------------------------------------------------
--
-- Table structure for table `Register`
--
CREATE TABLE `Register` (
`id` int( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
`Date` date default NULL ,
`Name` text,
`Company` text,
`Address` text,
`City` text,
`State` tinytext,
`Zip` text,
`marketarea` text,
`Phone` text,
`Email` text,
`Comments` text,
`OwnerNameA1` text,
`OwnerNameB1` text,
`PropAddr1` text,
`PropZip1` text,
`OwnerNameA2` text,
`OwnerNameB2` text,
`PropAddr2` text,
`PropZip2` text,
`OwnerNameA3` text,
`OwnerNameB3` text,
`PropAddr3` text,
`PropZip3` text,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =49;

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '

CREATE TABLE `Register` (
`id` int(10) unsigned NOT NULL auto_increm' at line 1

Problem With Data Import From Text File
When I try to import a text file with new data for an existing
table I get the error "1148 - the used command is not allowed
with this MySQL version."

I have tried with both PHPMyAdmin2.3 and with MySQLFront 2.5.
Both these GUI programmes have an "import from text file" command
which I have used successfully several times to add entries to
this table before - running just this MySQL version. I have
structured the data in the text file in just the same format as
previously.

Both these programmes are connecting to the database successfully
now and will display the contents of the existing table data and
strcutre of the database etc (despite an earlier connection
problem which seems to have been solved spontaneously).

But both now deliver exactly this error message (and therefore I
assume it is MySQL and not the interface programmes which is
doing it). I cannot see that I am doing anything different.

I have MySQL 4.0.12 on Windows ME PC with a local Apache server
and PHP.

PS I sent a long message about this and a connection problem
yesterday which was not succint enough.

Import Structured Text File Into Mysql
I've a lot of structured files like the following one I would like to import in a mysql database:

Message-ID: <417ee59f@mail-ha1>
Subject: test
From: renu [renu@solicomm.net]
Newsgroups: Practice

<html>
<head>

</head>
<body>
<p>
xghdgdfgfgdff
</p>
<p>
xgdsfssdfsdf
fsdfsfsdfhdgdfgfgdff
</p>
</body>
</html>

I need to import the first 4 rows in 4 columns (messageid, subject, form, newsgroups) and the last part of the text, which is in html, in a 5th colum.

The fact is that I'm not sure whether it's possible.
Should it be possible, could someone point me to the method/tool that could help me in doing that?

Trying To Import A Text File That Has A Non-standard Encoding
I have written a applicaiton that reads in a text file and then parses each line to store a record in MySQL.

I'm having problem with only this one file where when I open with notepad, there is no new line and instead the line breaker character is replaced with a number like 105788, 105704, 105708, and so on (its not the same number for each line)

However, when I open this same file with wordpad, the new line shows correctly. I was wondering if anyone can point out some suggestion as to how I can effectively import this file. Currently, my application is dependent on the fact that each field is seperated by a new line.

Can't Import More Than 3932 Recs From Text File
I am sure mysql can handle a larger import than this !

Any ideas why this should occur - it always fails around the same place - but not at a specific record (rec 3932,3930,3931).

Import Data From Text File Mysql
Im going to write a script in linux that updates my mysql database. How can i write a sql statemtn that updates my mysql table from a text file located on my machine?
lil confused bout the path of the txt file?

LOAD DATA INFILE Command To Import A Text File
I am using the LOAD DATA INFILE command to import a text file into
mysql.

However, there is much more text in the file than needed in my tables.
How can I make a selection from the text line. For example position 5 -
10 in field A, position 20-23 in field B, etc ...

Need To Insert Data From A Text File Into A Medium Text Field.
How can I go about inserting data into a MEDIUMTEXT field from an existing text file using Java.

Insert Text File In A Text Field
2 questions:

1) How can I insert a text file into a TEXT field (of a table)
by a mysql instruction ?;

2) How can I insert a microsoft word file into a BLOB field (of a table)
by a mysql instruction?

Import From Text
I have a text file which contains names and dates. the date is in the format
Sep-11-2001 12:30 AM.
I tried to put the text into Excel and then used Navicat to import from Excel.
But everytime the dates are converted to 1/1/2001.

Text Import
I need to append records from an Excel spreadsheet to an existing table. I think I should start by converted the Excel sheet to a text file then importing from there. I have to do this using myPHPAdmin. Am I on the right path and how do I start and import using myPHPAdmin?

CSV Import When There Are Commas In The Text?
I'm trying to grab a csv file from a remote server and import the data my mySQL DB.

I'm using Curl to grab the file contents and php to import the data into my DB.

The problem have is that the data in the csv file contains commas in the text field that is interferring with the import and I have no control over what is in the file.

eg the csv looks like:

id,name,description1,description2,date
1,pete,"this has a comma, in the text", "this also has, a comma", 2004-09-09
etc, etc
The additional commas mess up the import. Is there any way I can get this data into mysql and just tell it to ignore any commas in certain fields?



Import CSV, Text Files
how to automate the import of CSV, text files into MySql?

Import A Text Backup Of SQL Db Into Another One On Linux
I have a SQL file, which is a backup of a database (data+scheme).
The file was generated using MySQLGUI backup features on a windows 2k3 server.
Now I would like to import this data + scheme into a mysql server running on linux, there is no GUI on the machine.

2 questions if I may:

1. How do I import the described above data.
2. Will the meta data (permissions, collation & co.) will be restored as well, or will I need to reconfigure them ?

Import A .sql File
Ok, probably any easy task but not having much luck here. i exported to an .sql file a database from phpmyadmin. now, what i want to do is use that file to recreate the database on my local test machine. i do not have phpmyadmin installed on this system, so am looking for the proper query i can use at mysql command line to run.

Import CSV File
I should import a csv file into mysql table, so i write:

load data local infile <file name>
into table <Table name>
fields terminated by ','
enclosed by '"'
lines terminated by '
';

However, I find that it is time consuming for writing the query "fields terminated..............by '
'"
since I should import the csv many time.

So can I modify the default value of "fields terminated by" so that I could omit that part when I import the file?

Import .sql File
I am working with mysql for the first time. I figured I would try to learn a little about it by creating a Cacti SNMP monitoring server. I have created a database in mysql called cacti. The root password is also cacti. I have been fighting with importing the included cacti.sql file for days. I have tried multiple syntaxes and get the same error everytime. Here is what I have done:

mysql> mysql -u root -p cacti cacti < c:inetpubwwwrootcacticacti.sql;
ERROR:
Unknown command 'i'.
Show warnings disabled.
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'acti.
sql' at line 1

I am sure this is a stupid mistake because everything I read makes it sound like importing .sql files is easy.

Import Sql File Into PhpMyAdmin
I am trying to import SQL file which contains Structure & data into PhpMyAdmin locally and i get error message:

You have an error in your SQL syntax near 'ENGINE=MyISAM AUTO_INCREMENT=36 DEFAULT CHARSET=latin1' at line 14

The file size is about 1.95 MB. The file was exported through SQLyog as SQL Statements and the following fields were ticked:

-Include "USE dbname-" statement
-Include "DROP TABLE" STATEMENT
-Add "CREATE DATABASE"
-Lock All Tables For Read
-Create Bulk Insert Statements

The fields left unticked are:

-Flush Logs Before Dump
-Add Lock Around Insert Statements
-Set FOREIGN_KEY_CHECKS=0

Don't know much about MySQL, any help would be much appreciated.

Import CSV From String, Not A File
does anyone know if it's possible to import "geek@geeksupport.com,test@example.com,abc@example.com" into a temporary table with 1 field into mysql? This will be coming from a webpage, not a file.

I know I can chop it in php and do an insert on each email address, but hoping if there's some kind of built-in mysql to do this.



How To Import The Dumped File?
I have a mysqldump exported file( with structures), now I need to import it to a new database.

I learned about mysqlimport, it seems that it only support single table. but my dumped file have all the tables of a database.

Fastest Way To Import A *BIG* .sql File
i've a big file with sql stataments: it's about 35 GB (about 2 GB if zipped).

What's the fastest way to import it into mysql? Is there a way to import it from the zip/bzip2 file?

Import Txt-file To Mysql DB
On the one hand i have a mysql-table called "news". It has 4 fields, "uid" (with auto_increment attribute), "headline", "text", "author". On the other hand i have a txt-file in the following format.

headline|text|author
This file contains of several lines, all in the same format.
Is it possible to import this file to my database? I need the "headline" from the txt-file in my "headline" field and so on.. The uid-field has the attribute auto-increment, so i think i must not care about it, right? I tried some things but they didn't work.

Import Into A Table With A File
Our Database server has moved off of the local machine and is by itself. When I try to run:

load data local infile '/Users/test/Documents/CC.txt' into table bi_kinkead.new_macbook;
test.reseller_cc

I get an error because the file is not located locally. It is locaed on a server called Pluto. What is the formating to use so I can get this file imported?

Import Fixed Lenght Field From Ascii Text
does anyone have some suggestion to import Asccii text into Mysql tables

The tables are empty and can be created at import
The records from ascii text are fixed lenght but delimited by CRLF

The fields are not delimited but fixed lenght

Import A Directory Of Text Files Into A Mysql Database With Php?
I have a directory of text files that i'd like to import into a msql
table... I was wondering if there's an easier way to do this with
php/mysql, I'd like to avoid copy/pasting the entire directory
(thousands of files) into the database if i can.

The directory structure of the text files resembles...

somepath/A/Aerosmith/Song Name.txt - (extention varies)

What i'd like to do is use php to scan the directory and input
the file path information and the content from each file into a table
like...

Dir Artist Song Text Type
------------------------------------------------------------------------
A Aerosmith Song Name Fa La La La La (example text) File Ext
B Beatles Song Name Fa La La La La (example text) File Ext

Schedule Auto Import New Log / Text Files Into MySQL
Basically we have a SQL Server Database on our telecoms switch, to which under the maintenance contract we have no direct access. Every 15 mins log files are downloaded in *.log files (text files) which contain data we can upload to our own databases for querying. The log files are on an ftp server and the filenames comprise of date and time of dumps.

Requirement :

In short I would like to know the best way to automatically update tables on a MySQL database with the new log files as they appear or if there is some existing software which allows this type of schedule and auto import.

I would be very greatful if someone can give me some ideas with this problem as it would save me so much time and I am most familiar with mySql and Sql Server databases and would appreciate help in either database.

Sql Code To Import File Locally
I want to import a file to create tables in a database on my machine from command prompt, I have done this beofre but a long time ago, I have put the file in the bin folder of the MySql directory, i thought the code was something like ..file.sql

Can anyone tell me what it should be.

Import .xls File Into A Mysql Database
I have a .xls file that i would like to import into a mysql database, I am ok creating the mysql table in phpmyadmin on my webspace but i cant work out or find any useful tutorials on how to import the database from the .xls format and get it into the database short of building a form and submitting by hand which would take far to long.



How Do I Import .csv File Into My Mysql Database?
I woould like to know how to import csv files into my mysql databse, I tried the:

LOAD DATA LOCAL INFILE '/importfile.csv'
INTO TABLE test_table
FIELDS TERMINATED BY ','
LINES TERMINATED BY ''

Commands but I dont know where would i put these command and wher do put the "importfile.csv", what directory and location?

Import Excel CSV File Into MySQL
I have used MySQL for little while now but I have never had to import directly from a csv file.  I went to MySQL docs and thought I found the solution but it gives me an error. The csv file is in Excel format and has the first line with headings.  Here is the SQL statement that I tried but doesn't work:

LOAD DATA INFILE './List.csv'  INTO TABLE lsi_mailer (ListDate, ExpDate, Company, Address, City, State, Zip, DPBC, CR, County, Phone, Salutation, LName, FName, Title, Gender, Worksite, BType, SIC, SICDesc, BranchCode, ProdDate, MailDate)
FIELDS TERMINATED BY ','
LINES TERMINATED BY '
' ;

The files List.csv is in the MySQL data directory.  If I take out everything after the fields it seems to work but the data does not seem to import.

Import Only 1 Database From A Mysqldump File
i like to import only one Database include 37 Tables from a dumpfile. But i must be shure that only this one Database is imported. The dumpfile include more Databases (70) with >1500 Tables

Can i use this --database=onlyforum option for mysql ?

mysql -hlocalhost -uuser -p --database=onlyforum < alldatabases.sql

ore is there a other option to use?

Import Data From A Binary File
I have a binary file that contains data that was exported from Microsoft SQL. I have the details regarding the various columns that are contained in the file.

I am not sure if MySQL can actually import the data from such a file and load the contents in a table in a text format. Currently this is the only way that the person I am dealing with can provide the data.

Import CSV File With Numeric Data
I am trying to import a CSV file which was exported from another mysql database with comma separation and quote delimeters.  A numeric column is enclosed in quotes and cannot be directly imported into the target table since it is now a string.

How should I import this data?  I have tried to import it to an intermediate table with the id column defined as a varchar but I have been unable to convert that value back to a number.

Import File Delmited By The | Character
I have a .txt file of about 200,000 lines that I need to import into a mysql database. Each line contains four records, but unfortunately they are seperated by the | character. I have tried importing it using the LOAD DATA command but it imports everthing into one field. I need to import into four fields.
how to tell mysql that the file is | delimited?

Csv File(s) Exists Import Into MySQL
I am hoping to write a solution that imports any csv files that exist in a given directory into mySQL. I know how to write a SQL command to import a single file, but am wondering the best method to automate importing whenever a file shows up in a given directory (and even better move them to another directory post-import).

Is there something like a trigger inside of mySQL that can help me do this? I can run a cron or the like to check for files, parse them, run the mySQL commands, move them, etc. but I am hoping for a much cleaner internal answer. Since it will eventually be hosted I may not have the capability to run scripts.

Import Large Excel File
I have a large excel file, and some of the contents of it contain commas. I was wondering how I can import this information into mysql. I was thinking of using csv formant, but think the excess commas in the populated information will cause issues with this.

MySQL Import File/script
I have a fairly average skill in mysql. I just wanted to know what the command is to import a file of queries to, for example create a table. I wish to write the instructions in a text file then bring in the file instead of a line by line basis on the command line.

How Do You Import A Mysqldump File Using Query Browser?
I have a MySQL 4.1.5-gamma-nt-max instance running on a Windows 2000 Server box. I have tried creating a script to restore a mysqldump backup file to a schema on that server. Here is my syntax:

set foreign_key_checks=0;
source b:/folderwithdata/data.043006
set foreign_key_checks=1;

When I execute this locally on the server from the command line, it executes without a hitch. However, the server is going to be located in a server farm where I will not have access so I have tried to execute this from my workstation using Query Browser. I launch Query Browser and execute the script and get the following error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use. ErrorNr: 1064 near 'SOURCE B:/FOLDERWITHDATA/DATA.043006 SET FOREIGN_KEY_CHECKS=1' at
line 1

Like I said, it executes fine on the server via command line so I know it's not  bombing out on some syntax within the file itself. So I'm assuming it has something to do with how I'm writing the script in the GUI itself.

Import Tables From Another Non-Joomla Mysql File
Can someone tell me how I can import tables from another non-Joomla mysql file into Joomla? Basically it is just from one mySQL database into another. I use phpMyAdmin to import and export the entire file but I don't know how to do queries.

What I am trying to do is import all the articles I have built up using ccTiddlyWiki into Joomla. The only table names of relevance from the source file are:

id - title- body

IN other words, just the bare essentials.

The target files has a table called jos_content with columns:
id - title - title_alias - introtext - fulltext in that order and others but are not important.

I think it is fairly simple but I am not trained enough. I have 200 items so it would save an enormous amount of time!

It seems easy but I don't know enough about queries to do it well. I'm hoping that I can import the articles and then just go through the list in Joomla adding subtitles and so on to conform to Joomla database essentials.

There is another column called tags which I would be happy to have as well and I'm not bothered about start dates or anything else.

Import Large Size CSV File Into Table
I need to import a large size CSV file, around 1 million records into a table, I found that the speed is very slow, it takes 1 minute to import 1400 records. If I import the whole file, it will takes more than 10 hours.

Import Data From .txt File Into MySQL Table
i have text files which are generated daily and stored in a folder on the C: drive. I was wondering what would the mySQL command be to import that data into a mySQL table. The text file does not have a header with the field names so would i have to make that table first with the desired columns?? Also, does the file have to be in the databse directory or can it be anywhere on the machine??

Import Excel File Into Mysql Database
I was looking for information on how to import an excel file or other
text file into a MySql database. I have done this with both access
and SQL Server and am looking for a way to do this in MySql. I have
several hundred items i want to import into a parts database that is
currently in an excel file but can be saved as comma separated or
other format.

How To Import Excel File Into An Already Normalized Database?
I have a problem with the issue in the subject, i have all data in one big excel file, in a denormalized form, and on the other side, i have mysql database with many tables, which is already in production, and it is of course in the 3rd NF. How do i go about importing that excel file , is there any good tool i could use to handle prim/foreign key issues for me?

Command To Import Tabulated Txt File Into A Table
some of my clients are asking me to do a "import system" in my program, to they import xls data into their database...

So i know that there is a code to import tabulated txt files to a sql table.. but i didn’t know the command...

can someone help me? just say me the query command that I need to use pls -=^.^=-


Copyright © 2005-08 www.BigResource.com, All rights reserved