Don't use phpmyadmin for large import/export operations. Use CLI for that. CLI should work just fine most of the time as it has different timeout and processes info a lot faster.
Also if you're working with WordPress I recommend using WP CLI to handle the import/export process for the DB. This way it should also work most of the time without any problems. Just use wp db export
and wp db import <file>
.
If you really want using phpmyadmin
, you can try to adjust the MySQL settings to support large operations and allocate sufficient memory for example:
wait_timeout=28800 # 8 hours
interactive_timeout=28800
net_read_timeout=6000 # 100 minutes
net_write_timeout=6000
innodb_buffer_pool_size=4G # set to ~80% of available RAM
innodb_log_file_size=1G # Speeds up large transactions
You can try to add this in your import file (.sql file):
[mysqld]
max_allowed_packet=1G
Another thing you can try is to split large SQL files into multiple smaller files to facilitate the import process. Use tools like split
or BigDump
to process data in chunks.
You can also try to enable extended inserts while dumping the database like so
mysqldump --extended-insert --quick