Accidentally changed site URL and now I can't access Metabase

Hi,

I'm running the self-hosted version of Metabase and I acccidentally changed the site URL in the admin panel and now I can‘t access MB anymore. The message I am getting is too many redirects.

What can I do now? I don‘t know what more information I should give you in order to help, so please just ask me anything you need to know :innocent:

Any help appreciated, thanks!

Hi @ferdmaster
It sounds like you activated the redirect, so start Metabase with the environment variable set:
MB_REDIRECT_ALL_REQUESTS_TO_HTTPS=false and MB_SITE_URL=https://metabase.example.com
https://www.metabase.com/docs/latest/operations-guide/environment-variables.html

1 Like

Hi @flamber and thank you for the quick answer!
Is there any way to do this with a filebased Database running on Docker without migrating to MySQL/PostgreSQL first? I can only set those env vars when i start with a fresh docker container , and then i could copy the metabase.db file with the wrong setting. Would this even override the setting in the db file? Or would you recommend migrating to solve this issue?

@andirandy I can only recommending migrating away from H2:
https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html

But again, defining the two environment variables will the problem.

@flamber thank you, i am in the process of migrating, but faced an issue connecting with the (existing) mysql database. the database is on the same server (started with docker-compose, but it should be irrelevant in this case), and i can easily access it with any external app (for example, with the db integration in phpstorm), but i cannot connect to the db with the migration tool:

Could not connect to address=(host=xxx.xxx.xxx.xxx)(port=3306)(type=master) : Socket fail to connect to host:xxx.xxx.xxx.xxx, port:3306. connect timed out 

do you have any idea? i can ping the server in the metabase container too, so it is definitely reachable (after all it is the same server, localhost did not work either)

(ip hidden)

the whole error log:
clojure.lang.ExceptionInfo: ERROR Set up mysql target database and run migrations... {}
at metabase.cmd.copy$do_step$fn__76619.invoke(copy.clj:33)
at metabase.cmd.copy$do_step.invokeStatic(copy.clj:29)
at metabase.cmd.copy$do_step.invoke(copy.clj:27)
at metabase.cmd.copy$fn__76780$copy_BANG___76785$fn__76786.invoke(copy.clj:268)
at metabase.cmd.copy$fn__76780$copy_BANG___76785.invoke(copy.clj:256)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invokeStatic(load_from_h2.clj:35)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invoke(load_from_h2.clj:25)
at clojure.lang.Var.invoke(Var.java:384)
at metabase.cmd$load_from_h2.invokeStatic(cmd.clj:45)
at metabase.cmd$load_from_h2.invoke(cmd.clj:39)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:665)
at clojure.core$apply.invoke(core.clj:660)
at metabase.cmd$run_cmd$fn__76283.invoke(cmd.clj:191)
at metabase.cmd$run_cmd.invokeStatic(cmd.clj:191)
at metabase.cmd$run_cmd.invoke(cmd.clj:187)
at clojure.lang.Var.invoke(Var.java:388)
at metabase.core$run_cmd.invokeStatic(core.clj:149)
at metabase.core$run_cmd.invoke(core.clj:147)
at metabase.core$main.invokeStatic(core.clj:171)
at metabase.core$main.doInvoke(core.clj:166)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at metabase.core.main(Unknown Source)
Caused by: clojure.lang.ExceptionInfo: Unable to connect to Metabase mysql DB. {}
at metabase.db.setup$fn__35445$verify_db_connection__35450$fn__35451$fn__35452.invoke(setup.clj:102)
at metabase.db.setup$fn__35445$verify_db_connection__35450$fn__35451.invoke(setup.clj:100)
at metabase.db.setup$fn__35445$verify_db_connection__35450.invoke(setup.clj:94)
at metabase.db.setup$setup_db_BANG
$fn__35480$fn__35481.invoke(setup.clj:142)
at metabase.util$do_with_us_locale.invokeStatic(util.clj:687)
at metabase.util$do_with_us_locale.invoke(util.clj:673)
at metabase.db.setup$setup_db_BANG
$fn__35480.invoke(setup.clj:141)
at metabase.db.setup$setup_db_BANG_.invokeStatic(setup.clj:140)
at metabase.db.setup$setup_db_BANG_.invoke(setup.clj:136)
at metabase.cmd.copy$fn__76780$copy_BANG___76785$fn__76786$fn__76789.invoke(copy.clj:270)
at metabase.cmd.copy$do_step$fn__76619.invoke(copy.clj:30)
... 23 more
Caused by: java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=xxx.xxx.xxx.xxx)(port=3306)(type=master) : Socket fail to connect to host:xxx.xxx.xxx.xxx, port:3306. connect timed out
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(Unknown Source)
at java.sql/java.sql.DriverManager.getConnection(Unknown Source)
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_with_spec_QMARK_.invokeStatic(connection.clj:199)
at metabase.driver.sql_jdbc.connection$can_connect_with_spec_QMARK_.invoke(connection.clj:196)
at metabase.db.setup$fn__35445$verify_db_connection__35450$fn__35451$fn__35452.invoke(setup.clj:100)
... 33 more
Caused by: java.sql.SQLNonTransientConnectionException: Socket fail to connect to host:xxx.xxx.xxx.xxx, port:3306. connect timed out
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.createSocket(AbstractConnectProtocol.java:255)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createConnection(AbstractConnectProtocol.java:512)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1367)
... 51 more
Caused by: java.net.SocketTimeoutException: connect timed out
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createSocket(AbstractConnectProtocol.java:250)
... 53 more
Command failed with exception: ERROR Set up mysql target database and run migrations...

@andirandy "connect timed out" means it is caused by incorrect host or port, or a firewall blocking, or other network problems.

Ok, i fixed it by moving metabase.jar out of the container and running it outside of any container, now it worked. Had to fix some other issues (like that RSA thing), but migration is complete now, thank you :slight_smile: