All MariaDB and MySQL versions up to 5.1.61, 5.2.11 and 5.3.5.22 are vulnerable. Because the protocol uses random strings, the probability of hitting this bug is about 1/256. The following one-liner in bash will provide access to an affected server as the root user account, without actually knowing the password. The easiest thing to do is to restrict access to the local system in order to prevent remote access. The first rule of securing MySQL is to not expose to the network at large in the first place.
Source: https://thehackernews.com/2012/06/cve-2012-2122-serious-mysql.html