I'm able to reproduce this issue with a CentOS 6.9 Docker image. I downloaded the current version of the MySQL Java Connector (8.0.15) from the MySQL site, and tried to install it using
yum localinstall ./mysql-connector-java-8.0.15-1.el6.noarch.rpm
yum gave me this message during the dependency resolution process:
Package mysql-connector-java is obsoleted by mysql-connector-java, trying to install 1:mysql-connector-java-5.1.17-6.el6.noarch instead
The 5.1.17 driver comes from the CentOS 6 'Base' repo. The problem here is that this version of the driver is from July 2011. The predominant version of Java at this time appears to be Java 6, with Java 7 being released in the same month.
The current version of CentOS, CentOS 7, holds the 5.1.25 version of the driver as part of the 'Base' repo. This version of the driver was released in April 2013.
Since the packaged version of the drivers are several years old, it would be preferable to download the platform-independent distribution of the driver and configure it manually.
This is available from Download Connector/J page, under the 'Platform Independent' option. The process to install the driver and configure it is available in the documentation. Briefly, it involves extracting the TGZ/ZIP file to a known location and setting up the CLASSPATH variable so that the JDK/JRE on the system can find the driver.