# Error: com.mysql.cj.jdbc.Driver not loaded. Are you sure you've included the correct jdbc driver in :jdbc\_driver\_library?

**URL:** <https://discuss.elastic.co/t/error-com-mysql-cj-jdbc-driver-not-loaded-are-you-sure-youve-included-the-correct-jdbc-driver-in-jdbc-driver-library/194133>\
**Category:** Logstash\
**Created:** [August 7, 2019, 3:52am UTC](https://discuss.elastic.co/t/error-com-mysql-cj-jdbc-driver-not-loaded-are-you-sure-youve-included-the-correct-jdbc-driver-in-jdbc-driver-library/194133 "2019-08-07T03:52:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![manideep](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@manideep](https://discuss.elastic.co/u/manideep)\
**Post date:** [August 7, 2019, 3:52am UTC](https://discuss.elastic.co/t/error-com-mysql-cj-jdbc-driver-not-loaded-are-you-sure-youve-included-the-correct-jdbc-driver-in-jdbc-driver-library/194133/1 "2019-08-07T03:52:32Z")

</div>

Hi All,

I don't understand what's wrong in below conf file.

input {  
jdbc {  
jdbc\_driver\_library =\> "/usr/share/logstash/myjars/mysql-connector-java-8.0.11.jar"  
jdbc\_driver\_class =\> "com.mysql.cj.jdbc.Driver"  
jdbc\_connection\_string =\> "jdbc:mysql://10.0.1.133:5500/alumini\_factor"  
jdbc\_user =\> "root"  
jdbc\_password =\> "\*\*\*\*\*\*\*\*"  
statement =\> "select \* FROM profile"  
use\_column\_value =\> true  
tracking\_column =\> id  
}  
}

output {  
elasticsearch {  
document\_id =\> "%{id}"  
hosts =\> ["[http://localhost:9200](http://localhost:9200)"]  
index =\> "profiles"  
document\_type =\> "data"  
}  
}

P.S:  
Elasticsearch version 7.0.1  
Logstash version 7.3  
Mysql verion 5.7.26-0ubuntu0.16.04.1

Thanks,  
Manideep

---

<div class="post-metadata">

**Author:** ![guyboertje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guyboertje/32/31592_2.png) [@guyboertje](https://discuss.elastic.co/u/guyboertje)\
**Post date:** [August 7, 2019, 10:50am UTC](https://discuss.elastic.co/t/error-com-mysql-cj-jdbc-driver-not-loaded-are-you-sure-youve-included-the-correct-jdbc-driver-in-jdbc-driver-library/194133/2 "2019-08-07T10:50:11Z")

</div>

Are you using JDK 11?

---

<div class="post-metadata">

**Author:** ![manideep](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@manideep](https://discuss.elastic.co/u/manideep)\
**Post date:** [August 7, 2019, 1:08pm UTC](https://discuss.elastic.co/t/error-com-mysql-cj-jdbc-driver-not-loaded-are-you-sure-youve-included-the-correct-jdbc-driver-in-jdbc-driver-library/194133/3 "2019-08-07T13:08:22Z")

</div>

hi @guyboertje

I think it is JDK 8.

![image](https://us1.discourse-cdn.com/elastic/original/3X/9/e/9e006f61744a31ff90cc743c457adca3e285bc07.png)

Thanks,  
Manideep

---

<div class="post-metadata">

**Author:** ![guyboertje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guyboertje/32/31592_2.png) [@guyboertje](https://discuss.elastic.co/u/guyboertje)\
**Post date:** [August 7, 2019, 4:54pm UTC](https://discuss.elastic.co/t/error-com-mysql-cj-jdbc-driver-not-loaded-are-you-sure-youve-included-the-correct-jdbc-driver-in-jdbc-driver-library/194133/4 "2019-08-07T16:54:09Z")

</div>

Did you try using the "old" driver class `com.mysql.jdbc.Driver`?

---

<div class="post-metadata">

**Author:** ![manideep](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@manideep](https://discuss.elastic.co/u/manideep)\
**Post date:** [August 8, 2019, 3:41pm UTC](https://discuss.elastic.co/t/error-com-mysql-cj-jdbc-driver-not-loaded-are-you-sure-youve-included-the-correct-jdbc-driver-in-jdbc-driver-library/194133/5 "2019-08-08T15:41:16Z")

</div>

Hi @guyboertje

Thanks for the response.

I figured out the error.

As I am new to Linux, I did not understand the Logstash installation process.

i tried installing Logstash using APT given in the Logstash Docs.

Logstash was installed at /usr/share/logstash but the config folder was missing inside the Logstash.  
So, I externally copied the config folder inside the Logstash and tried to run it. It did not work.

Sometime later, i realized that config folder from original installation was in /etc/config.

So, I have two config folders one inside the Logstash and another in /etc/. (I am really not sure if this is the issue.)

Then, I deleted everything and downloaded tat.gz file and extracted to the location /usr/share/.

It now has config folder. I ran the logstash with my conf file and it worked.

Thanks,  
Manideep

---

<div class="post-metadata">

**Author:** ![manideep](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@manideep](https://discuss.elastic.co/u/manideep)\
**Post date:** [August 8, 2019, 3:46pm UTC](https://discuss.elastic.co/t/error-com-mysql-cj-jdbc-driver-not-loaded-are-you-sure-youve-included-the-correct-jdbc-driver-in-jdbc-driver-library/194133/6 "2019-08-08T15:46:03Z")

</div>

In my local windows, I used new driver as the jar is 8.0.1.

Now, in the linux, I used old driver as the jar is 5.1.38.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 5, 2019, 3:46pm UTC](https://discuss.elastic.co/t/error-com-mysql-cj-jdbc-driver-not-loaded-are-you-sure-youve-included-the-correct-jdbc-driver-in-jdbc-driver-library/194133/7 "2019-09-05T15:46:08Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
