Unlike kinetic energy, which a single body can possess, potential energy is always a property of a system that has atleast two bodies.
Potential energy exists in a system when two (or more) objects comprising the system interact by means of a conservative force
Your first defintion is actually incorrect. The potential energy belongs to the system of the object and the gravitational field. There are many misconceptions associated with a single object possessing a potential energy.
For example, when you raise a ball from the Earth's surface to a particular height, it is incorrectly stated that the ball possesses a gravitational potential energy (given by $mgy$). The correct way of saying it is that the system of the ball and the Earth or the system of the ball and the Earth's gravitational field has a gravitational potential energy given by $mgy$. In this case, the system consists of the ball and the Earth, which interact by means of a conservative force ; gravity.
Your expression for two objects is synonymous with the ball and the Earth. The system that they comprise has a property of potential energy because they interact by means of a conservative force.
You may have also come across the expression for gravitational potential energy of a system of three or more particles: $$U_g = \frac{1}{2} \sum_{i \neq j}\frac{-Gm_im_j}{r_{ij}}$$
In such a case, would it make sense to say that a single object out of all of them possess this value of potential energy (as your definition suggests)?
In response to your question (posted in the comments):
(1) In general, the article you mentioned has a lot of mistakes. Once again, potential energy is a property of the mass-field system, so neither the gravitational field, nor the mass possess the potential energy (equal to $V.m$, read my second point). In fact it is a property of the combined system and hence this statement:
Also why the gravitational field is assigned potential energy when the work on the body is done by field?
is physically meaningless. Note that some sources may claim that the gravitational potential energy is stored in the field. While not entirely accurate, this is somewhat justified, because the gravitational field would change with distance (just like potential energy would)
(2) You must not be confused between gravitational potential energy and gravitational potential. The gravitational potential is defined as $$V = \frac{U_g}{m}$$ where m is the mass of the source mass causing the field. It is only numerically equal to the potential energy when you substitute $m = 1 kg$
(3) It is incorrect to state that a single body possesses a potential energy. This notation however is too entrenched in our language, which is why you may see several references of it. However, a single isolated object cannot have a potential energy function (as described in my answer)