Check that your mysql settings are optimised. In particular, these… (in the my.cnf file).
This example is for a machine with 4GB RAM. I can’t guarantee that they are perfect, but they helped a bit on my system
# Set buffer pool size to 50-80% of your computer's memory
innodb_buffer_pool_size=2G
# Set the log file size to about 25% of the buffer pool size
innodb_log_file_size=512M
innodb_log_buffer_size=256M
# the default here is 4MB, or maybe 16MB?? in more recent versions, which sometimes allows for disconnects in the middle of transactions
max_allowed_packet=64M