Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to split sql in MAC OSX?

Is there any app for mac to split sql files or even script? I have a large files which i have to upload it to hosting that doesn't support files over 8 MB.

*I don't have SSH access

like image 331
user3067592 Avatar asked Dec 07 '13 20:12

user3067592


People also ask

How do I split a large SQL file?

Just specify the max file size that you can upload, and Sql Dump Splitter will take care of the rest. It will split your large . sql file out into smaller, ordered, numbered files. You can then easily import them one by one using phpMyAdmin.


2 Answers

You can use this : http://www.ozerov.de/bigdump/

Or

Use this command to split the sql file

split -l 5000 ./path/to/mysqldump.sql ./mysqldump/dbpart-

The split command takes a file and breaks it into multiple files. The -l 5000 part tells it to split the file every five thousand lines. The next bit is the path to your file, and the next part is the path you want to save the output to. Files will be saved as whatever filename you specify (e.g. “dbpart-”) with an alphabetical letter combination appended.

Now you should be able to import your files one at a time through phpMyAdmin without issue.

More info http://www.webmaster-source.com/2011/09/26/how-to-import-a-very-large-sql-dump-with-phpmyadmin/

like image 118
souvickcse Avatar answered Sep 19 '22 12:09

souvickcse


This tool should do the trick: MySQLDumpSplitter

It's free and open source.

Unlike the accepted answer to this question, this app will always keep extended inserts intact so the precise form of your query doesn't matter; the resulting files will always have valid SQL syntax.

Full disclosure: I am a share holder of the company that hosts this program.

like image 28
Wilbo Baggins Avatar answered Sep 18 '22 12:09

Wilbo Baggins