only full group by is the default setting for MySQL 5.7 and above
In your case the easiest soulution is to call select() and group() methods on the query with the same filed list.
So you have to end up with something like this.
$discoveryBooks = $this->DiscoveryBooks->find()
->select(['DiscoveryBooks.id', 'DiscoveryBooks.name', 'DiscoveryCards.name'])
->matching('DiscoveryCards', function ($q) use ($siteIds){
return $q->where([
'DiscoveryCards.site_id IN' => $siteIds
]);
})
->group(['DiscoveryBooks.id', 'DiscoveryBooks.name', 'DiscoveryCards.name'])
->where([
'published' => true,
'approved' => true
])
->all();