Sequel::DatabaseConnectionError: Java::JavaSql::SQLException: Access denied for user ''@'localhost' (using password: NO)

If jdbc_password_filepath replace jdbc_password no problem.

logstash 5.3.1
Ubuntu 14.04.5 LTS

[2017-04-26T16:44:34,676][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://localhost:9200/, :path=>"/"}
[2017-04-26T16:44:34,983][WARN ][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=>#<URI::HTTP:0x6fd7e512 URL:http://localhost:9200/>}
[2017-04-26T16:44:34,990][INFO ][logstash.outputs.elasticsearch] Using mapping template from {:path=>nil}
[2017-04-26T16:44:35,088][INFO ][logstash.outputs.elasticsearch] Attempting to install template {:manage_template=>{"template"=>"logstash-*", "version"=>50001, "settings"=>{"index.refresh_interval"=>"5s"}, "mappings"=>{"_default_"=>{"_all"=>{"enabled"=>true, "norms"=>false}, "dynamic_templates"=>[{"message_field"=>{"path_match"=>"message", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false}}}, {"string_fields"=>{"match"=>"*", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false, "fields"=>{"keyword"=>{"type"=>"keyword"}}}}}], "properties"=>{"@timestamp"=>{"type"=>"date", "include_in_all"=>false}, "@version"=>{"type"=>"keyword", "include_in_all"=>false}, "geoip"=>{"dynamic"=>true, "properties"=>{"ip"=>{"type"=>"ip"}, "location"=>{"type"=>"geo_point"}, "latitude"=>{"type"=>"half_float"}, "longitude"=>{"type"=>"half_float"}}}}}}}}
[2017-04-26T16:44:35,133][INFO ][logstash.outputs.elasticsearch] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>[#<URI::Generic:0x69bdc36e URL://localhost:9200>]}
[2017-04-26T16:44:35,140][INFO ][logstash.pipeline        ] Starting pipeline {"id"=>"main", "pipeline.workers"=>1, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>5, "pipeline.max_inflight"=>125}
[2017-04-26T16:44:36,472][ERROR][logstash.pipeline        ] Error registering plugin {:plugin=>"<LogStash::Inputs::Jdbc jdbc_driver_library=>\"/usr/share/java/mysql-connector-java-5.1.28.jar\", jdbc_driver_class=>\"com.mysql.jdbc.Driver\", jdbc_connection_string=>\"jdbc:mysql://127.0.0.1:3306/test\", connection_retry_attempts=>5, jdbc_validate_connection=>false, jdbc_user=>\"root\", jdbc_password_filepath=>\"/etc/logstash/test\", schedule=>\"*/1 * * * *\", statement=>\"SELECT * FROM test_bot\", type=>\"testbot\", id=>\"fd170003f3a04ea9bd2c3dceae29d91c81f5fb79-1\", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>\"plain_e5e3c4ca-f423-48c5-b0c2-07c5cd514f64\", enable_metric=>true, charset=>\"UTF-8\">, jdbc_paging_enabled=>false, jdbc_page_size=>100000, jdbc_validation_timeout=>3600, jdbc_pool_timeout=>5, sql_log_level=>\"info\", connection_retry_attempts_wait_time=>0.5, last_run_metadata_path=>\"/.logstash_jdbc_last_run\", use_column_value=>false, tracking_column_type=>\"numeric\", clean_run=>false, record_last_run=>true, lowercase_column_names=>true>", :error=>"Java::JavaSql::SQLException: Access denied for user ''@'localhost' (using password: NO)"}
[2017-04-26T16:44:37,000][ERROR][logstash.agent           ] Pipeline aborted due to error {:exception=>#<Sequel::DatabaseConnectionError: Java::JavaSql::SQLException: Access denied for user ''@'localhost' (using password: NO)>, :backtrace=>["com.mysql.jdbc.SQLError.createSQLException(com/mysql/jdbc/SQLError.java:1086)", "com.mysql.jdbc.MysqlIO.checkErrorPacket(com/mysql/jdbc/MysqlIO.java:4237)", "com.mysql.jdbc.MysqlIO.checkErrorPacket(com/mysql/jdbc/MysqlIO.java:4169)", "com.mysql.jdbc.MysqlIO.checkErrorPacket(com/mysql/jdbc/MysqlIO.java:928)", "com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(com/mysql/jdbc/MysqlIO.java:1750)", "com.mysql.jdbc.MysqlIO.doHandshake(com/mysql/jdbc/MysqlIO.java:1290)", "com.mysql.jdbc.ConnectionImpl.coreConnect(com/mysql/jdbc/ConnectionImpl.java:2493)", "com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(com/mysql/jdbc/ConnectionImpl.java:2526)", "com.mysql.jdbc.ConnectionImpl.createNewIO(com/mysql/jdbc/ConnectionImpl.java:2311)", "com.mysql.jdbc.ConnectionImpl.<init>(com/mysql/jdbc/ConnectionImpl.java:834)", "com.mysql.jdbc.JDBC4Connection.<init>(com/mysql/jdbc/JDBC4Connection.java:47)", "java.lang.reflect.Constructor.newInstance(java/lang/reflect/Constructor.java:423)", "com.mysql.jdbc.Util.handleNewInstance(com/mysql/jdbc/Util.java:411)", "com.mysql.jdbc.ConnectionImpl.getInstance(com/mysql/jdbc/ConnectionImpl.java:416)", "com.mysql.jdbc.NonRegisteringDriver.connect(com/mysql/jdbc/NonRegisteringDriver.java:347)", "java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498)", "RUBY.connect(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/sequel-4.44.0/lib/sequel/adapters/jdbc.rb:226)", "RUBY.make_new(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/sequel-4.44.0/lib/sequel/connection_pool.rb:116)", "RUBY.make_new(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/sequel-4.44.0/lib/sequel/connection_pool/threaded.rb:228)", "RUBY.available(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/sequel-4.44.0/lib/sequel/connection_pool/threaded.rb:201)", "RUBY._acquire(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/sequel-4.44.0/lib/sequel/connection_pool/threaded.rb:137)", "RUBY.acquire(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/sequel-4.44.0/lib/sequel/connection_pool/threaded.rb:151)", "RUBY.sync(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/sequel-4.44.0/lib/sequel/connection_pool/threaded.rb:282)", "org.jruby.ext.thread.Mutex.synchronize(org/jruby/ext/thread/Mutex.java:149)", "RUBY.sync(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/sequel-4.44.0/lib/sequel/connection_pool/threaded.rb:282)", "RUBY.acquire(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/sequel-4.44.0/lib/sequel/connection_pool/threaded.rb:150)", "RUBY.hold(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/sequel-4.44.0/lib/sequel/connection_pool/threaded.rb:106)", "RUBY.synchronize(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/sequel-4.44.0/lib/sequel/database/connecting.rb:285)", "RUBY.test_connection(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/sequel-4.44.0/lib/sequel/database/connecting.rb:295)", "RUBY.prepare_jdbc_connection(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.1.3/lib/logstash/plugin_mixins/jdbc.rb:171)", "RUBY.register(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.1.3/lib/logstash/inputs/jdbc.rb:191)", "RUBY.register_plugin(/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:257)", "RUBY.register_plugins(/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:268)", "org.jruby.RubyArray.each(org/jruby/RubyArray.java:1613)", "RUBY.register_plugins(/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:268)", "RUBY.start_inputs(/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:412)", "RUBY.start_workers(/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:312)", "RUBY.run(/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:207)", "RUBY.start_pipeline(/usr/share/logstash/logstash-core/lib/logstash/agent.rb:389)", "java.lang.Thread.run(java/lang/Thread.java:745)"]}
[2017-04-26T16:44:37,131][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
[2017-04-26T16:44:40,070][WARN ][logstash.agent           ] stopping pipeline {:id=>"main"}

Why ?
Sequel::DatabaseConnectionError: Java::JavaSql::SQLException: Access denied for user ''@'localhost' (using password: NO)

No idea ?

Hello:

I would suggest making sure that logstash user is able to read /etc/logstash/test as the mysql error shows that no password is being used for auth

This was the first thing I checked.
There are no problems here.
If you look at the log then the problem goes here

Could it be that this file has some non-printable (and undesired) character? Have you tried to delete it and recreate it again?

Yes, of course.

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