473,770 Members | 6,978 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to import large MySQL data dump using PHP?

My webhost does not give me shell access. Normally, I use this sort of
command on my local machine:

c:\datac:\mysql \bin\mysql -uroot -pxxxxx db < file.sql

My webhost gives me PhpMyAdmin access, but I can never use that successfully
with large files. The sql file I need to import is 15MB.

thanks,

brian
Dec 31 '06 #1
4 3084

Brian Huether schreef:
My webhost does not give me shell access. Normally, I use this sort of
command on my local machine:

c:\datac:\mysql \bin\mysql -uroot -pxxxxx db < file.sql

My webhost gives me PhpMyAdmin access, but I can never use that successfully
with large files. The sql file I need to import is 15MB.
This is a tricky one. I tried it myself, and only succeded by splitting
the large dump by hand, using a editor. Then you can upload it by php
myadmin.

I used this command:

mysqldump -uuser -p database --compatible=mysq l323
--set-variable=net_bu ffer_length=163 84 totaaldump20061 027

to get a format that is easily editable by hand...

It worked for me.. if you find a better solution, I'm all ears....

Paul

Dec 31 '06 #2
if u will send me a mail, i may give u a mysql-backup-code that i
created.
else, i will tell u my functions:
-----------------------------------
first function: mysql_list_tabl es ($DB);
-----------------------------------
this function allowed, at least at my server. like "SHOW TABLES FROM
{$DB}", but allowed.
after it i created a SQL syntax of table creation.
-----------------------------------
second function: mysql_query ("SHOW COLUMNS FROM {$TABLE}");
-----------------------------------
to see the field list and types, youll have to use it.
just do print_r and see.
-----------------------------------
second function: mysql_query ("SELECT * FROM {$TABLE}");
-----------------------------------
i dont think that i have to explain. simply use that list with INSERT
SQL syntax..

good luck!

Dec 31 '06 #3
if u will send me a mail, i may give u a mysql-backup-code that i
created.
else, i will tell u my functions:
-----------------------------------
first function: mysql_list_tabl es ($DB);
-----------------------------------
this function allowed, at least at my server. like "SHOW TABLES FROM
{$DB}", but allowed.
after it i created a SQL syntax of table creation.
-----------------------------------
second function: mysql_query ("SHOW COLUMNS FROM {$TABLE}");
-----------------------------------
to see the field list and types, youll have to use it.
just do print_r and see.
-----------------------------------
third function: mysql_query ("SELECT * FROM {$TABLE}");
-----------------------------------
i dont think that i have to explain. simply use that list with INSERT
SQL syntax..

good luck!

Jan 1 '07 #4
"Brian Huether" <bh********@com castSPAM.netpíš e v diskusním příspěvku
news:Y_******** *************** *******@comcast .com...
My webhost does not give me shell access. Normally, I use this sort of
command on my local machine:

c:\datac:\mysql \bin\mysql -uroot -pxxxxx db < file.sql

My webhost gives me PhpMyAdmin access, but I can never use that
successfully with large files. The sql file I need to import is 15MB.
Here is problem with php script timeout. Usually webhosting provider set
this option to few seconds only and not allow to change it inside php
script.
Workaround of your problem is to split sql file to few parts and run these
in a right order.
Best way is to change webhosting provider :-)

--

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
Jan 2 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
23643
by: Michel Feldheim | last post by:
Hi everybody, I have some big csv-like files with 15.000 and more artikles stored in it. They should be put into a mysql database. I thought about PHP processing but only the read and print of these lines using the read_csv() function as in the attached script has a more-minutes execution time. What would be the better solution.. a Visual Basic written import tool that uses ODCB or a PHP using one?
8
25437
by: Jamie Meyers | last post by:
Does anyone know how to import a .sql dump file into a mysql database using php. I know how to do it using commandline, mysql < test.sql, but I am writing an install script, and was wondering if it is possible to do it this way. If not, do you know of any parser that will do all the importing/table creation the .sql file defines? Any response is much appreciated. Thanks, Jamie
0
2020
by: Vidhya CS | last post by:
Hi , I am trying to export a database from one machine ie linux, and import the same database to another machine ie ,solaris . I exported the database using the following command . mysqldump -c -u vidhya ifmonitor > $HOME/ifmonito.backup. this is ok , ifmonitor-backup has the table creation info as well as the table data .
6
3868
by: NotGiven | last post by:
I have a db that I need to dump into a format that can be easily read my MS Access. I tried the dump with regular PHPAdmin. Then I used the dump to run a query in MS Access. Errors occurred because MySQL inserts a backslash, "\", in front of an apostophe that user enters in a text field and MS Access doesn't know how to interpret that. Any ideas for easily getting whatever kind of data from MySQL to MS Access?
0
1780
by: steve | last post by:
I am having huge problems migrating large db’s from one server to another. I use phpmyadmin to dump the data into a file, and then migrate it to my production server. Then I try to use this: mysql dbname < filename but if the tables are too large, it simply does not work. So I tried the following two work-arounds, which work but are tedious. Is there a nicer way to do it: Solution A: Create a dump file with subset of all the...
4
12726
by: news | last post by:
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
4
3966
by: BostonNole | last post by:
I am looking for suggestions on the most efficient way to import 7 different fixed width files into a DataSet. Not all at the same time. One file at a time, but the format could change from file to file. I have 7 (and more coming) different fixed width files that my clients provide to me, within each one the field sizes and ordering is slightly different...maddening I know. Each file could possibly be as large as 150 MG with around...
10
2148
by: Avi | last post by:
Hi I need to read in a large set of text files (9GB+ each) into a database table based on fixed width lengths. There are several ways to complete this, but I am wondering if anyone has insight into the FASTEST way to read in the data and chop it up ahead of posting it into the DB. So far, things work, but they are far slower than expected.
7
4196
by: Randy | last post by:
Folks: We have a web-based app that's _really_ slowing down because multiple clients are writing their own private data into a single, central database. I guess the previous programmer did things this way because it made things easy. Well, I'm the person that has to put up with the long-term headache. Anywho, someone at work wants things sped up, so what I'm looking at doing is this for each client:
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10057
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8883
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3970
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.