Solved

Importing large sql files in mysql from the server

Posted on 2007-04-01
9
618 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
The viewer will learn how to count occurrences of each item in an array.
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 …

688 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