How can I programmatically change a MySql variable (foreign_keys_check)?

$wpdb->query() doesn’t return the data but the rows affected, use $wpdb->get_var().