Quite often I inherit WordPress websites that have been neglected over the years and require some routine maintenance to get them up-to-date

Normally the best way to do this WordPress maintenance is to grab a copy of the live site and get it running on a VVV Vagrant box. A recent WordPress website redesign job needed just this cleaning up as it had had nearly 50,000 comments in the spam comments queue. Clearing them out wasn’t an issue with the Batch Spam Comment Delete plugin, what was an issue was importing the 46MB sql file into vagrant via phpMyAdmin which would then timeout.

There are various ways you can increase these timeout value in the php-fpm & nginx conf files, but by far the easiest way to manage this large sql file was to import it using mysql on the command line. Simply log into your running vagrant box via ssh using the command below:

Then browse to the sql file location on the vagrant box, mine usually end up in the projects www folder under /svr/www. You’ll need to go back a few directories to get there using the following command as ssh drops you into the home directory on the box

Once into your sql folder, simply run the command below to import the file, changing ‘database_name’ and ‘name_of_your.sql’ respectively. You’ll get prompted for the mysql password which on vagrant is the same as the username – root.

It’s really quick and much easier than faffing about in phpMyAdmin.