title: How can you solve the mysql connection error with logstash?
body: <p>How can you solve the mysql connection error with logstash?</p>
  <p>I tried all the information in Google.</p>
  <p>However, it continues to fail, leaving questions in the stack overflow.</p>
  <p>Please help me.</p>
  <p>file name : mysql.conf (logstash file have the same route)</p>
  <pre><code>input {
      jdbc {
          clean_run =&gt; true
          jdbc_driver_library =&gt; &quot;C:\ElasticSearch\mysql-connector-java-8.0.23\mysql-connector-java-8.0.23.jar&quot;
          jdbc_driver_class =&gt; &quot;com.mysql.jdbc.Driver&quot;
          jdbc_connection_string =&gt; &quot;jdbc:mysql://localhost:3306/jobschema&quot;, &quot;root&quot;,&quot;1234&quot;
          schedule =&gt; &quot;* * * * *&quot;
          statement =&gt; &quot;select jobid, jobname, executiontime, jobstatus from logstashplugin WHERE jobid &gt; :sql_last_value&quot;
          use_column_value =&gt; true
          tracking_column =&gt; &quot;jobid&quot;
      }
  }
  output{
      elasticsearch {
          hosts =&gt; [&quot;localhost:9200&quot;]
          index =&gt; &quot;logstashmysql&quot;
      }
      stdout {
          codec =&gt; rubydebug
      }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/E7Wrt.png" rel="nofollow noreferrer">enter image description here</a></p>
  <hr />
  <p>Mysql - DB
  <a href="https://i.stack.imgur.com/tZ96q.png" rel="nofollow noreferrer">enter image description here</a></p>
  <pre><code>mysql&gt; show databases;
  +--------------------+
  | Database           |
  +--------------------+
  | commerce           |
  | information_schema |
  | jobschema          |
  | mysql              |
  | performance_schema |
  | sakila             |
  | sys                |
  | world              |
  +--------------------+
  8 rows in set (0.00 sec)
  
  mysql&gt; use jobschema;
  Database changed
  mysql&gt; show tables;
  +---------------------+
  | Tables_in_jobschema |
  +---------------------+
  | logplugin           |
  +---------------------+
  1 row in set (0.00 sec)
  
  mysql&gt; select * from logplugin;
  +-------+---------+---------------+-----------+
  | jobid | jobname | executiontime | jobstatus |
  +-------+---------+---------------+-----------+
  |     1 | job1    |            10 | Completed |
  |     2 | job2    |            15 | Failed    |
  |     3 | job3    |            10 | Failed    |
  |     4 | job4    |            30 | Failed    |
  |     5 | job5    |            10 | Failed    |
  |     6 | job6    |            15 | Failed    |
  |     7 | job7    |            15 | Completed |
  +-------+---------+---------------+-----------+
  7 rows in set (0.00 sec)
  </code></pre>
  <hr />
  <p>logstash &amp; db connection error file image</p>
  <pre><code>[2021-03-23T11:39:41,142][ERROR][logstash.agent           ] Failed to execute action {:action=&gt;LogStash::PipelineAction::Create/pipeline_id:main, :exception=&gt;&quot;LogStash::ConfigurationError&quot;, :message=&gt;&quot;Expected one of [ \\t\\r\\n], \&quot;#\&quot;, \&quot;{\&quot;, \&quot;}\&quot; at line 6, column 74 (byte 282) after input {\n    jdbc {\n        clean_run =&gt; true\n        jdbc_driver_library =&gt; \&quot;C:\\ElasticSearch\\mysql-connector-java-8.0.23\\mysql-connector-java-8.0.23.jar\&quot;\n        jdbc_driver_class =&gt; \&quot;com.mysql.jdbc.Driver\&quot;\n        jdbc_connection_string =&gt; \&quot;jdbc:mysql://localhost:3306/jobschema\&quot;&quot;, :backtrace=&gt;[&quot;C:/ElasticSearch/logstash-7.11.2/logstash-core/lib/logstash/compiler.rb:32:in `compile_imperative'&quot;, &quot;org/logstash/execution/AbstractPipelineExt.java:184:in `initialize'&quot;, &quot;org/logstash/execution/JavaBasePipelineExt.java:69:in `initialize'&quot;, &quot;C:/ElasticSearch/logstash-7.11.2/logstash-core/lib/logstash/java_pipeline.rb:47:in `initialize'&quot;, &quot;C:/ElasticSearch/logstash-7.11.2/logstash-core/lib/logstash/pipeline_action/create.rb:52:in `execute'&quot;, &quot;C:/ElasticSearch/logstash-7.11.2/logstash-core/lib/logstash/agent.rb:371:in `block in converge_state'&quot;]}
  [2021-03-23T11:39:41,614][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=&gt;9600}
  [2021-03-23T11:39:46,677][INFO ][logstash.runner          ] Logstash shut down.
  [2021-03-23T11:39:46,693][FATAL][org.logstash.Logstash    ] Logstash stopped processing because of an error: (SystemExit) exit
  org.jruby.exceptions.SystemExit: (SystemExit) exit
          at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:747) ~[jruby-complete-9.2.13.0.jar:?]
          at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:710) ~[jruby-complete-9.2.13.0.jar:?]
          at C_3a_.ElasticSearch.logstash_minus_7_dot_11_dot_2.lib.bootstrap.environment.&lt;main&gt;(C:\ElasticSearch\logstash-7.11.2\lib\bootstrap\environment.rb:89) ~[?:?]
  </code></pre>
  <p><a href="https://i.stack.imgur.com/LWD9f.png" rel="nofollow noreferrer">enter image description here</a></p>