WordPress

Use MySQL Command Line for Large WordPress DB Imports

You should always use the MySQL command line for large WordPress DB imports.

Why?

Not only is it much faster, but it’s more performant – regardless of the environment.

To get started, run the first statement below via the MySQL command line tool to disable auto-commit, unique and foreign key checks.

set autocommit=0; set unique_checks=0; set foreign_key_checks=0;

Select your DB and run your import.

use databasename; source /path/to/large-wordpress-dump.sql;

And then run this last line to enable them again.

set autocommit=0; set unique_checks=0; set foreign_key_checks=0;

I prefer to use a bash function tied to an alias for this command.

 

Leave a Reply