473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 3061

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=mysql323
--set-variable=net_buffer_length=16384 totaaldump20061027

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_tables ($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_tables ($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********@comcastSPAM.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
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...
8
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...
0
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...
6
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...
0
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:...
4
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...
4
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...
10
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...
7
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.