连接MySql数据库

报错一
Driver class 'org.gjt.mm.mysql.Driver' could not be found, make sure the 'MySQL' driver (jar file) is installed.
org.gjt.mm.mysql.Driver

报错原因:这个报错的原因是因为当前的kettle目录下没有需要连接的数据库驱动,所以我们需要下载一个驱动放到他的lib包里重新启动即可,我创建的是mysql连接所以需要mysql连接驱动
解决方法:
maven仓库下载合适的启动jar包,我选择的是下载人数最多的
https://mvnrepository.com/artifact/mysql/mysql-connector-java
将下载好的jar解压放到\data-integration\lib\的目录下就可以了

再次进行测试连接,可能会报这样的错误
错误二:
Connection failed. Verify all connection parameters and confirm that the appropriate driver is installed.
Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

错误原因:原因是因为没有选择相应的配置
扫描二维码关注公众号,回复:
17372262 查看本文章

解决方法:在选项中新增useSSL=false即可

再次进行测试连接可能还会报这样的错误
Connection failed. Verify all connection parameters and confirm that the appropriate driver is installed.
The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specifc time zone value if you want to utilize time zone support.

解决方案:
设定mysql数据库时区即可或者在kettle数据库连接的选项中配置serverTimezone参数,我使用的是后者。
show variables like '% time_zone%';
set global time_zone = '+8:00';


最后再次测试连接,成功。
