Import large SQL databases into MySQL
As rules, the bulk of all WordPress sites have small database. When I say “small”, I mean until 100 MB. But if we say about e-shops or for example about news portals, size of database may exceed several hundred megabytes. If you try import such file, you probably get the error.
Problem: How to import large SQL files into MySQL using the command line
Solution: It's simple, run this:
mysql -h 127.0.0.1 -u username -p database_name < /path_to_file/"database (1).sql"
Note: If your file contain spaces in the name, use quotes, as shown in the example.
UPD: For export you can use next command:
mysqldump -h 127.0.0.1 -u username -p database_name > /path_to_file/"database (1).sql"