mysql function for 2 rows (same name) with group by
depending from what You are looking for, it could be:

SELECT  MIN(`id`) as id,  `name` , MAX( sallary ) as salary ,  `month` ,  `year` 
FROM  `test` 
GROUP BY  `name` ,  `month` ,  `year` 


or because mike have 2 salary in Jan 2017 (and of course it same Mike ;) ):

SELECT  MIN(`id`) as id,  `name` , SUM( sallary ) as salary ,  `month` ,  `year` 
FROM  `test` 
GROUP BY  `name` ,  `month` ,  `year` 


because as unique identifier You choose Name - MIN(id) allow avoid errors when MySQL default settings - ONLY_FULL_GROUP_BY

Specially for Rick James :)

From original question, we can see -  id, can not be used as IDENTIFIER

so queries example with MIN and MAX for id - could be (and this realistic live scenario) - first or most resent contact with person

Before we go to next form of query - first we need decide mike(id=1) for Jan 17 and mike (id=4) for Jan 17, it is same person? and salary for Jan - it MAX or SUM (as I include in my examples).