Solved

Importing large sql files in mysql from the server

Posted on 2007-04-01
9
611 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

820 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