Solved

Importing large sql files in mysql from the server

Posted on 2007-04-01
9
608 Views
Last Modified: 2013-12-12
I always have problems loading large files into phpmyadmin, is there a program that I can drop into a folder and choose a .sql file to import into a mysql database?
I am using a php/mysql.
The sql files can go up to 30 megs.

0
Comment
Question by:CrazyPhil
  • 3
  • 3
9 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 125 total points
ID: 18833728
hi - if you use a free program called sqlyog (http://www.webyog.com) you can do this, but you can also do it if you have access to the command line mysql client - you can just specify the file to run something like

mysql -u userName -pYourPassword <  yourSqlFile.sql
0
 

Author Comment

by:CrazyPhil
ID: 18833749
Unfortunately I cannot use that program, though it does look useful. My dbs are only accessible from the internal server not outside of it; though I am switching hosts soon and that may change. Also I don't think I have command line access...though I could be wrong.
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 18833791
if all you have access to is the server and running things internally then you have no choice to use whatever tools they have given you - which if this is only phpmyadmin, this is all you can do,

however if you can create php pages you would be able to get them to execute your command line arguements and get around it
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:CrazyPhil
ID: 18833854
So a simple;

mysql_query('mysql -u userName -pYourPassword <  yourSqlFile.sql');

Would work? where would I place the sql file?
0
 
LVL 19

Assisted Solution

by:Kim Ryan
Kim Ryan earned 125 total points
ID: 18834256
I don't think that wiuld work. You need to start mysql program from a command line, so you need some type of terminal (shell) access to the server. You can palce .sql file anywhere on the server but need to specify the full path to it, if this is not the same directory you are running mysql from.
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 18834314
no - mysql_query would not work in this case, you would need to use shell_exec and then those commands, you would have to place the sql file on your server, which you may or may not have permissions to do
0
 

Author Comment

by:CrazyPhil
ID: 19097722
I have resolved this, I switched to a better host, surprisingly this made a difference.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Creating and Managing Databases with phpMyAdmin in cPanel.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now