记一次kettle连接mysql报错,解决方法

记一次kettle连接mysql报错

错误连接数据库 [158Mysql] : org.pentaho.di.core.exception.KettleDatabaseException: 
Error occurred while trying to connect to the database

Error connecting to database: (using class org.gjt.mm.mysql.Driver)
Access denied for user 'root'@'172.16.35.56' (using password: YES)


org.pentaho.di.core.exception.KettleDatabaseException: 
Error occurred while trying to connect to the database

Error connecting to database: (using class org.gjt.mm.mysql.Driver)
Access denied for user 'root'@'172.16.35.56' (using password: YES)


	at org.pentaho.di.core.database.Database.normalConnect(Database.java:472)
	at org.pentaho.di.core.database.Database.connect(Database.java:370)
	at org.pentaho.di.core.database.Database.connect(Database.java:341)
	at org.pentaho.di.core.database.Database.connect(Database.java:331)
	at org.pentaho.di.core.database.DatabaseFactory.getConnectionTestReport(DatabaseFactory.java:80)
	at org.pentaho.di.core.database.DatabaseMeta.testConnection(DatabaseMeta.java:2783)
	at org.pentaho.ui.database.event.DataHandler.testDatabaseConnection(DataHandler.java:597)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:313)
	at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:157)
	at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:141)
	at org.pentaho.ui.xul.swt.tags.SwtButton.access$500(SwtButton.java:43)
	at org.pentaho.ui.xul.swt.tags.SwtButton$4.widgetSelected(SwtButton.java:137)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
	at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Display.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
	at org.eclipse.jface.window.Window.open(Window.java:796)
	at org.pentaho.di.ui.xul.KettleDialog.show(KettleDialog.java:80)
	at org.pentaho.di.ui.xul.KettleDialog.show(KettleDialog.java:47)
	at org.pentaho.di.ui.core.database.dialog.XulDatabaseDialog.open(XulDatabaseDialog.java:116)
	at org.pentaho.di.ui.core.database.dialog.DatabaseDialog.open(DatabaseDialog.java:60)
	at org.pentaho.di.ui.repo.RepositoryDialog$12.function(RepositoryDialog.java:170)
	at org.eclipse.swt.browser.WebSite.Invoke(Unknown Source)
	at org.eclipse.swt.browser.WebSite$7.method6(Unknown Source)
	at org.eclipse.swt.internal.ole.win32.COMObject.callback6(Unknown Source)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(Unknown Source)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
	at org.pentaho.di.ui.repo.RepositoryDialog.open(RepositoryDialog.java:239)
	at org.pentaho.di.ui.repo.RepositoryDialog.open(RepositoryDialog.java:83)
	at org.pentaho.di.ui.repo.RepositoryDialog.open(RepositoryDialog.java:79)
	at org.pentaho.di.ui.repo.RepositoryDialog.openCreation(RepositoryDialog.java:253)
	at org.pentaho.di.ui.repo.RepositoryConnectMenu$2.widgetSelected(RepositoryConnectMenu.java:124)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
	at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Display.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
	at org.pentaho.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:1366)
	at org.pentaho.di.ui.spoon.Spoon.waitForDispose(Spoon.java:8022)
	at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:9277)
	at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:692)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.pentaho.commons.launcher.Launcher.main(Launcher.java:92)
Caused by: org.pentaho.di.core.exception.KettleDatabaseException: 
Error connecting to database: (using class org.gjt.mm.mysql.Driver)
Access denied for user 'root'@'172.16.35.56' (using password: YES)

分析原因:Access denied for user ‘root’@‘172.16.35.56’ (using password: YES)说明密码不对,但是我输入的密码的确是正确的,然后我用另一台服务器去telnet mysql服务器的3306端口,出现了报错
记一次kettle连接mysql报错,解决方法

5.7.23	T13U'r!9l{@o0KVhORmysql_native_passwordConnection closed by foreign host.

这句话说明了要链接的mysql数据库只允许其所在的服务器连接,如果别的网段或者客户端去连接,需要在mysql服务端上设置一下允许的ip权限

进入MySQL数据库,查看root权限,如果使用show grants for root;会报错:There is no such grant defined for user ‘root’ on host ‘%’,需要改成show grants for root@localhost;查看

mysql> show grants for root;
ERROR 1141 (42000): There is no such grant defined for user 'root' on host '%'
mysql> 
mysql> show grants for root@localhost;
+---------------------------------------------------------------------+
| Grants for root@localhost                                           |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION        |
+---------------------------------------------------------------------+

记一次kettle连接mysql报错,解决方法
执行授权语句,使所有ip都能登录,将localhost改成%即可

grant all privileges on *.* to 'root'@'%' identified by '密码';

记一次kettle连接mysql报错,解决方法修改完之后,再次使用show grants for root,就可以使用了
然后再次使用kettle进入连接
记一次kettle连接mysql报错,解决方法
点击add
记一次kettle连接mysql报错,解决方法
点击
记一次kettle连接mysql报错,解决方法
选择 Database Repository,然后点击 Get Started
记一次kettle连接mysql报错,解决方法
起一个名字,然后点击None
记一次kettle连接mysql报错,解决方法
点击Create new Connection
记一次kettle连接mysql报错,解决方法选择MySQL,主机名称,数据库名称,用户名,密码
记一次kettle连接mysql报错,解决方法
连接成功
记一次kettle连接mysql报错,解决方法

上一篇:真的不要打扰思考中的程序员!


下一篇:谈谈对IOC及DI的理解与思考