How to split sql in MAC OSX?

17.2k views Asked by At

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

4

There are 4 answers

6
souvickcse On BEST ANSWER

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/

0
Marc Delisle On

The UploadDir feature in phpMyAdmin could help you, if you have FTP access and can modify your phpMyAdmin's configuration (or are allowed to install your own instance of phpMyAdmin).

http://docs.phpmyadmin.net/en/latest/config.html?highlight=uploaddir#cfg_UploadDir

1
Wilbo Baggins On

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.

0
techturbulence On

You can split into working SQL statements with:

csplit -s -f db-part db.sql "/^# Dump of table/" "{99}"

Which makes up to 99 files named 'db-part[n]' from db.sql

You can use "CREATE TABLE" or "INSERT INTO" instead of "# Dump of ..."

Also: Avoid installing any programs or uploading your data into any online service. You don't know what will be done with your information!