9

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

user3067592
  • 351
  • 2
  • 4
  • 15

4 Answers4

16

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/

souvickcse
  • 7,742
  • 5
  • 37
  • 64
  • 3
    On my system, `split` also has a `-b` flag. You could then use `split -b 8m` instead of `split -l 5000`. Of course, in both cases, you'd have to concatenate the files on the server, since neither guarantees that you don't split during some commands. – Waleed Khan Dec 07 '13 at 20:31
  • Thanks Guys, it was great, but i got an error "#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near... " is that caused because for splitting? – user3067592 Dec 07 '13 at 20:39
  • Yes as @WaleedKhan Khan mentioned earlier that you have to check you don't split any command. – souvickcse Dec 07 '13 at 20:41
  • I'm not familiar with databases, i just move my website from my previous VPS to new hosting on Godaddy, so is there any simple way to check commands? – user3067592 Dec 07 '13 at 20:48
  • Ok let me check currently i am on my windows, i'll get back to you soon. – souvickcse Dec 07 '13 at 20:50
  • ok I find this link http://www.ozerov.de/bigdump/ I didn't tried it yet but i think it will solve your problem. And it is very easy to use. – souvickcse Dec 07 '13 at 20:56
7

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.

Wilbo Baggins
  • 2,701
  • 3
  • 26
  • 39
0

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

Marc Delisle
  • 8,879
  • 3
  • 29
  • 29
0

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!

techturbulence
  • 192
  • 1
  • 10