Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Use host.docker.internal as the default host for release mode

天舟d0ced08817e2
diff --git a/frontend/src/components/InstanceForm.vue b/frontend/src/components/InstanceForm.vue
index 3e80ff7253..46b4d0c1e6 100644
--- a/frontend/src/components/InstanceForm.vue
+++ b/frontend/src/components/InstanceForm.vue
@@ -69,7 +69,7 @@ input[type="number"] {
type="text"
id="host"
name="host"
- placeholder="e.g. 127.0.0.1 | localhost | /tmp/mysql.sock"
+ placeholder="e.g. host.docker.internal | <<ip>> | <<local socket>>"
class="textfield mt-1 w-full"
:disabled="!allowEdit"
:value="state.instance.host"
@@ -327,7 +327,7 @@ import cloneDeep from "lodash-es/cloneDeep";
import isEqual from "lodash-es/isEqual";
import { toClipboard } from "@soerenmartius/vue3-clipboard";
import EnvironmentSelect from "../components/EnvironmentSelect.vue";
-import { instanceSlug, isDBAOrOwner } from "../utils";
+import { instanceSlug, isDBAOrOwner, isDev } from "../utils";
import {
Instance,
InstanceCreate,
@@ -383,7 +383,9 @@ export default {
environmentId: UNKNOWN_ID,
name: "New Instance",
engine: "MYSQL",
- host: "127.0.0.1",
+ // In dev mode, Bytebase is likely run in naked style and access the local network via 127.0.0.1.
+ // In release mode, Bytebase is likely run inside docker and access the local network via host.docker.internal.
+ host: isDev() ? "127.0.0.1" : "host.docker.internal",
username: "",
},
updatedPassword: "",
diff --git a/store/seed/release/10001__init_seed.sql b/store/seed/release/10001__init_seed.sql
index cce836f0a2..92a0e0fd1e 100644
--- a/store/seed/release/10001__init_seed.sql
+++ b/store/seed/release/10001__init_seed.sql
@@ -62,7 +62,7 @@ VALUES
101,
'MySQL Test (You can follow the "External Link" field to bring up the MySQL server)',
'MYSQL',
- '172.17.0.1',
+ 'host.docker.internal',
'3306',
'https://docs.bytebase.com/install/docker#start-a-mysql-docker-instance-for-testing'
);
@@ -140,7 +140,7 @@ VALUES
102,
'MySQL Prod (You can follow the "External Link" field to bring up the MySQL server)',
'MYSQL',
- '172.17.0.1',
+ 'host.docker.internal',
'3306',
'https://docs.bytebase.com/install/docker#start-a-mysql-docker-instance-for-testing'
);