How to split sql in MAC OSX?

你说的曾经没有我的故事 提交于 2019-12-03 03:34: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/

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.

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

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!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!