sqoop连接MySQL报错Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is

Error reported when sqoop connects to mysql

The complete error report is as follows:

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

Preface

I recently came into contact with the CDH cluster, and when I used sqoop to transfer the data in MySql, I found that my database version was 8.0, so
I added the 8.0 database driver mysql-connector-java-8.0 to the sqoop lib. 30.jar, and then it can be connected;
but when I try to connect to a 5.7.24 version of mysql, an error is reported, but I found a 5.7.3 MySQL and tried it and it can be connected. Is it possible? Does it just happen to be so stuck?

I hope someone who knows better can explain it.

problem solved

There is no need to specify --driver when sqoop connects to MySQL, but I am wondering if it conflicts, but if I specify it and then connect again, an error will still be reported.

I read a lot of questions on Baidu, but the answers I saw were all emmm. There was talk of lowering the database driver version, but after I lowered it, I couldn't connect to the higher version of MySQL. In the end, I had no choice but to try and put a lower version of the driver in, hoping it wouldn't conflict.

Fortunately, I placed a mysql-connector-java-5.1.27.jar and used sqoop list-databases --connect to connect. No errors were reported and the database was displayed normally.

sqoop list-databases --connect jdbc:mysql://xxx:3306/databasename --username user --password yourpassword

But this only temporarily solves the problem. If anyone can see it and explain it a little bit, I would be very grateful!

Guess you like

Origin blog.csdn.net/weixin_55549435/article/details/126449116