Import Large data file into MySQL
How to import a large sql file into mysql when phpmyadmin has hit it’s 5 or so megabyte limit?
This is a common problem and the SERPs are terrible so I will place this up here to make it easier to find.
- Create the destination database in MySQL
- Put the .sql file into a convenient location (the MySQL /bin directory would be perfect w/XAMPP)
- login to MySQl
- SOURCE sqlfilename (if you put it outside mysql bin, you probably need the full path)
*** IF THIS HELPED YOU PLEASE HELP OTHERS by sharing this post. It will help make it easier to find when other’s ask the same question.
How to import large file
The SERPs for this issue are awful. Linux “gurus” leading users to find and use binary file splitting utilities (the .sql file is text, just in case you didn’t know), fee-based utilities that reportedly don’t work well either, misconceptions about how MySQL works, and all sorts of suggestions for hack-ish workarounds that should be really, really embarrassing for the authors of those comments. Oh, and of course dozens of little untested script sin perl,php, sed/awk etc to do just what MySQL can do for itself (if you know the command).
phpMyAdmin fails to import large file
Just use SOURCE. Or, if you want to be clever and have system privileges, just copy the original MySQL database file from the origin server and put it into the MySQL data directory of the destination server. Imagine that! MySQL knows how to read it’s own binary database files! Heh… didn’t you know MySQL is really a file system and not actually a relational database system? Whatever. Just use the SOURCE command to import large files into MySQL.