How to split sql in MAC OSX?

后端 未结 4 924
广开言路
广开言路 2021-02-04 15:51

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 ha

相关标签:
4条回答
  • 2021-02-04 16:17

    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 讨论(0)
  • 2021-02-04 16:17

    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

    0 讨论(0)
  • 2021-02-04 16:22

    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 讨论(0)
  • 2021-02-04 16:24

    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!

    0 讨论(0)
提交回复
热议问题