Restoring a dump with the mysql client means looking up the user, password and host first. wp db import reads them from wp-config.php.
A plain file:
wp db import backup.sql
And a compressed one, straight from a pipe. The - tells it to read from standard input:
gunzip -c backup-2026-11-30.sql.gz | wp db import -
I like how that pairs with wp db export - | gzip on the backup side. No temporary uncompressed file on disk.
By default it turns off unique and foreign key checks during the import, which makes big dumps load faster. --skip-optimization keeps them on. It also strips SQL modes that WordPress itself does not use, unless you pass --skip-sql-mode-compat.
Here’s the part that can hurt: the command just runs the SQL in the file. A normal wp db export dump contains DROP TABLE IF EXISTS for each table, so importing it replaces your current tables completely. Everything written since the dump was made is gone. Make a fresh export of the current state first, so you can go back if you grabbed the wrong file.
Further reading: wp db import, wp db export