How To Install mysql-connector-java on CentOS 7

In this tutorial we learn how to install mysql-connector-java on CentOS 7. mysql-connector-java is Official JDBC driver for MySQL

Introduction

In this tutorial we learn how to install mysql-connector-java on CentOS 7.

What is mysql-connector-java

MySQL Connector/J is a native Java driver that converts JDBC (Java Database Connectivity) calls into the network protocol used by the MySQL database. It lets developers working with the Java programming language easily build programs and applets that interact with MySQL and connect all corporate data, even in a heterogeneous environment. MySQL Connector/J is a Type IV JDBC driver and has a complete JDBC feature set that supports the capabilities of MySQL.

We can use yum or dnf to install mysql-connector-java on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install mysql-connector-java.

Install mysql-connector-java on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install mysql-connector-java using yum by running the following command:

sudo yum -y install mysql-connector-java

Install mysql-connector-java on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install mysql-connector-java using dnf by running the following command:

sudo dnf -y install mysql-connector-java

How To Uninstall mysql-connector-java on CentOS 7

To uninstall only the mysql-connector-java package we can use the following command:

sudo dnf remove mysql-connector-java

References

Summary

In this tutorial we learn how to install mysql-connector-java on CentOS 7 using yum and dnf.