Skip to content

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

chore: instruct docker users to use the right hostname (#2284)

Danny Xufafc59b73047
diff --git a/frontend/src/components/CreateInstanceForm.vue b/frontend/src/components/CreateInstanceForm.vue
index 1d0c66665c..1cf4f2fa84 100644
--- a/frontend/src/components/CreateInstanceForm.vue
+++ b/frontend/src/components/CreateInstanceForm.vue
@@ -498,6 +498,19 @@ const testConnection = () => {
title: t("instance.successfully-connected-instance"),
});
} else {
+ if (
+ connectionInfo.host == "localhost" ||
+ connectionInfo.host == "127.0.0.1"
+ ) {
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("instance.failed-to-connect-instance-localhost"),
+ description: resultSet.error,
+ // Manual hide, because user may need time to inspect the error
+ manualHide: true,
+ });
+ }
pushNotification({
module: "bytebase",
style: "CRITICAL",
diff --git a/frontend/src/components/InstanceForm.vue b/frontend/src/components/InstanceForm.vue
index 9375dc6415..57ab3ce177 100644
--- a/frontend/src/components/InstanceForm.vue
+++ b/frontend/src/components/InstanceForm.vue
@@ -765,6 +765,19 @@ const testConnection = () => {
title: t("instance.successfully-connected-instance"),
});
} else {
+ if (
+ connectionInfo.host == "localhost" ||
+ connectionInfo.host == "127.0.0.1"
+ ) {
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("instance.failed-to-connect-instance-localhost"),
+ description: resultSet.error,
+ // Manual hide, because user may need time to inspect the error
+ manualHide: true,
+ });
+ }
pushNotification({
module: "bytebase",
style: "CRITICAL",
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index f447cd9784..833dfda8e5 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -646,6 +646,7 @@
"copy-grant-statement": "CREATE USER and GRANT statements copied to clipboard. Paste to your mysql client to apply.",
"successfully-connected-instance": "Successfully connected instance.",
"failed-to-connect-instance": "Failed to connect instance.",
+ "failed-to-connect-instance-localhost": "Failed to connect instance.\nIf you run Bytebase with Docker, please try \"host.docker.internal\" for the host address.",
"search-instance-name": "Search instance name",
"no-read-only-data-source-support": "The {database} does not currently support creating read-only connections",
"grants": "Grants"
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 7658a8c190..d10ce2d70e 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -647,6 +647,7 @@
"copy-grant-statement": "CREATE USER and GRANT 语句已复制到剪贴板。 粘贴到您的 mysql 客户端。",
"successfully-connected-instance": "成功连接到实例。",
"failed-to-connect-instance": "连接到实例失败。",
+ "failed-to-connect-instance-localhost": "连接到实例失败。\n如果您使用的 Docker 部署,请尝试使用 \"host.docker.internal\" 作为 Host 地址。",
"search-instance-name": "搜索实例名称",
"no-read-only-data-source-support": "暂时不支持 {database} 创建只读连接",
"grants": "权限"