Solved

Importing large sql files in mysql from the server

Posted on 2007-04-01
9
607 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:CrazyPhil
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
I have resolved this, I switched to a better host, surprisingly this made a difference.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

771 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

10 Experts available now in Live!

Get 1:1 Help Now