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




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.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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?

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 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 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

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 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

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.

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.

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?

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.

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.

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

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.

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?

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?

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.

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 -=^.^=-

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.

Error Code #1064 Trying To Import SQL File
Im trying to import an SQL query file but get this error:

#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 'DEFAULT CHARSET=latin1 AUTO_INCREMENT=1' at line 28


Here is the code and the last line is line 28:
-----------------------------------------

CREATE TABLE `carts` (

`id` int( 8 ) NOT NULL AUTO_INCREMENT ,
`visitor_id` varchar( 26 ) NOT NULL default '',
`photo_id` varchar( 7 ) NOT NULL default '',
`added` varchar( 14 ) NOT NULL default '',
`ptype` char( 1 ) NOT NULL default '',
`prid` int( 10 ) NOT NULL default '0',
`quantity` int( 10 ) NOT NULL default '1',
UNIQUE KEY `id` ( `id` )
) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =1 .

Import Data Form Txt Or Cvs File Format
I have a fully installed version of MySql Server 5.0 including MySql Administration, MIGRATION Tool, Query Browser and System Tray Monitor.

I have lots of Data stored in a txt File. I do not want to type them all in. How do I import Data from a txt or cvs File format? They are standardizes.

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 ...

Alter Table Based On Comment Header In Import File
I have a text file which is the output of a Perl script that parses Windows Media Log files into a media analytics table. There are some additional columns which are defined by the customer so the actual table format can and does change. The engineer who provides this table has created a comment header with revision information as well as column names. Is there anything I can do to have MySQL look at the comment header and alter my table to include the newly added columns without destroying any data in the table? The column names would always be in the same line in the import file and when a new field is added, it would be appended to the field list, not added anywhere in between existing fields.

Example:

# FIELDS: client_ip,date_YYYY-MM-DD, time_HH:MM:SS,http_method,c_url,status_code,
total_bytes,transfer_time,"referrer",referrer_host,"user_agent",
total_object_size,byte_range_start,byte_range_end,last_byte_served_flag,
first_byte_served_flag,all_bytes_served_flag, akm_c_ip_country, akm_c_ip_dma, akm_c_ip_lat, akm_c_ip_long,CPROG,MARKET,NG_FORMAT,SITE_ID,STATION_ID,PCAST_TITLE,PCAST_AUTHOR,
PCAST_CAT

How To Import "mysqldump" File Into Different Database?
We have successfully used "mysqldump" to create backup files for our databases on our mysql installation. We wish to test the quality/integrity of our dump files by importing a dump file into an empty database having a name different from the original source database from which we created the mysqldump file.

Can someone offer an example of a command we would use to restore a dumpfile into a database different from the original source database?

How Do I Upload A File To MySQL Database And View That File
I do not know how to upload a file to MySQL database and view the posting file on the webpage. I followed the code on-line that show me how to upload, but when I click "browse" to open my file in local drive and click "upload". Nothing happen ! How can I view it on the web page to make sure it was saved in data base.

Log-error File 'not Found' But This Same File Being Written To?!
I recently put up a message board and I get around 150+ hits a day so far. I've recently had some people sign up with my board but unfortunately, no one seems to be posting (they're just lurking around). I'm currently doing some promotions in the hope that others will post (like giving away a Lord of the Rings poster to all users who has 20 posts or more).

Of course, my board has only been up for less than a month (3 weeks to be exact) so I know I need to be patient but I would appreciate any advice you can give me on how to turn lurkers into posters.

Import From CSV
Using SQLyog 5.02 into MySQL server 5.0. Have built table structures and am
trying to import data from CSV. I get a rather non-descript dialog box
saying only "Error while importing data".

Does anyone have any suggestions on how to better accomplish this import or
how this error could be deciphered?

Import To 5 From 4
I have a site in a remote server that uses MySQL 4.1.10; MySQL charset is utf8 and MySQL connection collation is utf8_general_ci

I want to transport all of this tables to a new server that uses MySQL 5.0.45; charset and connection collation is the same.

I'm using phpmyadmin.

I'm not able to succeed!

When the table has 400 registers the error message is:
Fatal error: Maximum execution time of 300 seconds exceeded in /opt/lampp/phpmyadmin/libraries/string.lib.php on line 91

When the table has 30 registers the error is:

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 '' at line 29

What's wrong?

DB Import
I'm having problem importing an existing database to different server. Everytime it giving same error.

CREATE TABLE `7stat` (

`usrid` int( 11 ) default NULL ,
`date` date default NULL ,
`time` time default '00:00:00',
`pg_views` int( 11 ) default '0',
`num` float default NULL ,
`received_pay` char( 3 ) default 'no'
) ENGINE = MYISAM DEFAULT CHARSET = latin1;

MySQL said:

#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 'DEFAULT CHARSET=latin1' at line 8

Why it is happening? what is the solution. I heard someone that i need spilit the database becoz it is big. But it is only 1.5MB.


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