Cant Connect to Database

Hi Everyone, i tried metabase on my linux server with running .jar and MySQL on the same server.
but i cant connect Mysql database with error

No matching clause: Could not connect to address=(host=)(port=3306)(type=master) : (conn=4132258) Access denied for user ‘root’@‘127.0.0.1’ (using password: YES)\nCurrent charset is UTF-8. If password has been set using other charset, consider using option ‘passwordCharacterEncoding’

I think the password is right,
if i use ssh connection i just get return dbname:null

Hi @herdikun
Without knowing which version of Metabase or MySQL, then you’re likely seeing this - check comments for workarounds:
https://github.com/metabase/metabase/issues/12545

i donwload tastest metabase version and using mysql 10.4.13

@herdikun Please post “Diagnostic Info” from Admin > Troubleshooting.
And there’s no MySQL version starting with 10 (yet). You’re using MariaDB.
Make sure that your credentials are correct and that you are allowed to connect from the specified host. Try using another tool to validate the credentials, example dbeaver.io
Check the logs on MariaDB, sometimes it contains more details.

You are right, i am using MariaDB, and the credential is correct. I am connected with the same server, and i can remote the database with Heidi or with the same server.

[941257a8-f724-479b-a569-de41ef0aa184] 2020-11-17T16:13:45+07:00 INFO metabase.driver.impl Initializing driver :mysql…
[941257a8-f724-479b-a569-de41ef0aa184] 2020-11-17T16:13:45+07:00 INFO metabase.driver.mysql You may need to add trustServerCertificate=true to the additional connection options to connect with SSL.
[941257a8-f724-479b-a569-de41ef0aa184] 2020-11-17T16:13:45+07:00 ERROR metabase.driver.util Database connection error
java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=)(port=3306)(type=master) : Could not connect to :3306 : Remote host terminated the handshake
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:73)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:192)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1372)
at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:635)
at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:150)
at org.mariadb.jdbc.Driver.connect(Driver.java:89)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:189)
at clojure.java.jdbc$get_driver_connection.invokeStatic(jdbc.clj:271)
at clojure.java.jdbc$get_driver_connection.invoke(jdbc.clj:250)
at clojure.java.jdbc$get_connection.invokeStatic(jdbc.clj:411)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:274)
at clojure.java.jdbc$db_query_with_resultset_STAR_.invokeStatic(jdbc.clj:1111)
at clojure.java.jdbc$db_query_with_resultset_STAR_.invoke(jdbc.clj:1093)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1182)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1160)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invokeStatic(connection.clj:192)
at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invoke(connection.clj:187)
at metabase.driver.sql_jdbc$fn__78120.invokeStatic(sql_jdbc.clj:36)
at metabase.driver.sql_jdbc$fn__78120.invoke(sql_jdbc.clj:34)
at metabase.driver.mysql$fn__77242.invokeStatic(mysql.clj:76)
at metabase.driver.mysql$fn__77242.invoke(mysql.clj:72)
at clojure.lang.MultiFn.invoke(MultiFn.java:234)
at metabase.driver.util$can_connect_with_details_QMARK_$fn__22524.invoke(util.clj:35)
at metabase.util$do_with_timeout$fn__10218.invoke(util.clj:324)
at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2030)
at clojure.lang.AFn.call(AFn.java:18)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.sql.SQLNonTransientConnectionException: Could not connect to :3306 : Remote host terminated the handshake
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:73)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:183)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createConnection(AbstractConnectProtocol.java:566)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1367)
… 30 more

@herdikun

  1. Please post “Diagnostic Info” from Admin > Troubleshooting.
  2. Have you tried adding trustServerCertificate=true to the connection options in Admin > Databases?
  3. The error you’re posting now looks like it’s failing an SSL handshake - are you requiring SSL on MariaDB?
  4. Check the MariaDB log for more details. Check the MariaDB database table mysql.user for the credentials.

i tried to use this
MB_DB_CONNECTION_URI=“mysql://:/?user=&password=&useSSL=true”

but i still getting this error
2020-11-18 17:27:20,421 ERROR driver.util :: Database connection error
java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=localhost)(port=3306)(type=master) : Could not connect to localhost:3306 : Remote host terminated the handshake

@herdikun
You need to answer the questions being asked otherwise it’s impossible to help you.
Okay, so you are trying to use MariaDB as the application database?

i have success to using SSL on Metabase, and i try to add trustServerCertificate=true
i think my password is correct and it is using myslq_native_password

Yes i am using MariaDB. on my local computer is work normally

but i still get this error

@herdikun

  1. Post “Diagnostic Info” from Admin > Troubleshooting
  2. Are you trying to setup MariaDB as the Metabase application database, or are you trying to connect to MariaDB as a data source?

{
“browser-info”: {
“language”: “en-GB”,
“platform”: “Win32”,
“userAgent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36”,
“vendor”: “Google Inc.”
},
“system-info”: {
“file.encoding”: “UTF-8”,
“java.runtime.name”: “OpenJDK Runtime Environment”,
“java.runtime.version”: “11.0.9.1+1-Ubuntu-0ubuntu1.20.04”,
“java.vendor”: “Ubuntu”,
“java.vendor.url”: “https://ubuntu.com/”,
“java.version”: “11.0.9.1”,
“java.vm.name”: “OpenJDK 64-Bit Server VM”,
“java.vm.version”: “11.0.9.1+1-Ubuntu-0ubuntu1.20.04”,
“os.name”: “Linux”,
“os.version”: “5.4.0-53-generic”,
“user.language”: “en”,
“user.timezone”: “Asia/Jakarta”
},
“metabase-info”: {
“databases”: [
“h2”
],
“hosting-env”: “unknown”,
“application-database”: “h2”,
“application-database-details”: {
“database”: {
“name”: “H2”,
“version”: “1.4.197 (2018-03-18)”
},
“jdbc-driver”: {
“name”: “H2 JDBC Driver”,
“version”: “1.4.197 (2018-03-18)”
}
},
“run-mode”: “prod”,
“version”: {
“date”: “2020-11-12”,
“tag”: “v0.37.1”,
“branch”: “release-x.37.x”,
“hash”: “ba57ab6”
},
“settings”: {
“report-timezone”: null
}
}
}

I am trying to connect MariaDB as a data source not application Database

@herdikun

  1. Do you even have SSL enabled on MariaDB? If no, then do not try to connect with SSL.
  2. So Metabase is running on the same Ubuntu server as MariaDB?
  3. What happens if you run this command on the Ubuntu server? (replace username/password)
    mysql --host=127.0.0.1 --user=YOUR-USERNAME --password=YOUR-PASSWORD
  4. You should migrate away from H2 if you are using Metabase in production:
    https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html
  1. I have try to connect with SSL and without SSL. but its didnt work
  2. Yes, Metabase on the same server with MariaDB.
  3. it access denied, but if i try mysql -u USERNAME -p and enter same password, i can login to mysql
  4. Ok.

@herdikun You get Access Denied because you are not allowing access via 127.0.0.1, but only via localhost.
https://stackoverflow.com/questions/10823854/using-for-host-when-creating-a-mysql-user

i have tried to set host on metabase as localhost, but it still cannot connected

Thanks i can connect with new user