How to set «GD2» as the default image adapter from the command line?

Magento ≥ 2.2

bin/magento config:set dev/image/default_adapter GD2
bin/magento cache:clean

Magento < 2.2

mysql --host=<host> --user=<user> --password=<password> -D <database> -e "\
	UPDATE core_config_data SET value = 'GD2' WHERE 'dev/image/default_adapter' = path; \
";
bin/magento cache:clean

See also: