Issue connecting to MySQL on Local from Dremio on local Docker

SSL is disabled for MySQL Server on Local. Tried with alternative users too and still it is not working.
MySQL version: 8.0.21 (MySQL Community Server - GPL)
Dremio version: 4.8.0-202009180238090394-b0a98b73

mysql> SHOW VARIABLES LIKE ‘%ssl%’;
±-------------------±---------+
| Variable_name | Value |
±-------------------±---------+
| admin_ssl_ca | |
| admin_ssl_capath | |
| admin_ssl_cert | |
| admin_ssl_cipher | |
| admin_ssl_crl | |
| admin_ssl_crlpath | |
| admin_ssl_key | |
| have_openssl | DISABLED |
| have_ssl | DISABLED |
| mysqlx_ssl_ca | |
| mysqlx_ssl_capath | |
| mysqlx_ssl_cert | |
| mysqlx_ssl_cipher | |
| mysqlx_ssl_crl | |
| mysqlx_ssl_crlpath | |
| mysqlx_ssl_key | |
| ssl_ca | |
| ssl_capath | |
| ssl_cert | |
| ssl_cipher | |
| ssl_crl | |
| ssl_crlpath | |
| ssl_fips_mode | OFF |
| ssl_key | |
±-------------------±---------+
24 rows in set (0.00 sec)

Error:
[Times: user=0.09 sys=0.01, real=0.03 secs]
2020-10-14 09:59:15,872 [start-LocalMySQL] ERROR c.d.e.store.jdbc.JdbcStoragePlugin - Connection is not valid.
java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=localhost)(port=3306)(type=master) : Connection refused (Connection refused)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:234)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:165)
at org.mariadb.jdbc.MariaDbDataSource.getConnection(MariaDbDataSource.java:290)
at org.mariadb.jdbc.MariaDbDataSource.getPooledConnection(MariaDbDataSource.java:455)
at org.apache.commons.dbcp2.datasources.InstanceKeyDataSource.testCPDS(InstanceKeyDataSource.java:1018)
at org.apache.commons.dbcp2.datasources.SharedPoolDataSource.registerPool(SharedPoolDataSource.java:167)
at org.apache.commons.dbcp2.datasources.SharedPoolDataSource.getPooledConnectionAndInfo(SharedPoolDataSource.java:127)
at org.apache.commons.dbcp2.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:884)
at org.apache.commons.dbcp2.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:858)
at com.dremio.exec.store.jdbc.CloseableDataSource$DatasourceWrapper.getConnection(CloseableDataSource.java:87)
at com.dremio.exec.store.jdbc.JdbcStoragePlugin.getState(JdbcStoragePlugin.java:406)
at com.dremio.exec.catalog.ManagedStoragePlugin.setLocals(ManagedStoragePlugin.java:827)
at com.dremio.exec.catalog.ManagedStoragePlugin.lambda$newStartSupplier$1(ManagedStoragePlugin.java:524)
at com.dremio.exec.catalog.ManagedStoragePlugin.lambda$nameSupplier$3(ManagedStoragePlugin.java:591)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

@deepaksekar2101

Are you able to provide us with the Dremio source settings for MySQL?

Thanks
Bali

@deepaksekar2101

What version of Dremio is this? couple of things

  • It seems your connection is not valid so can we check of localhost is resolved? Is your Mysql running on the same node as Dremio? Are you able to ping localhost?
  • From command line are you able to run the below and able to connect?
    mysql -u root -p
    password:

Thanks
Bali

Dremio is on a docker container and mysql is on my host machine.

Using host.docker.internal instead of localhost fixed the issue. Thanks!

1 Like

Hi thank for sharing this.

I am experiencing more or less the same problem, but I have dremio on the host machine, and mysql running on a docker container.
Any clue of what I can do to fix it in my situation?

thanks in advance,
Alfredo

@seralf Is Dremio able to talk to the docker on mysql port?