Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-05 (世界標準時間)。"],[],[],null,["# Set up Spanner migration tool\n\nThis document describes how to install and run the Spanner\nmigration tool (SMT) on Cloud Shell. For more information about SMT,\nsee [Spanner migration tool](https://googlecloudplatform.github.io/spanner-migration-tool/).\n\nBefore you begin\n----------------\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n1. [Install](/sdk/docs/install) the Google Cloud CLI.\n2. To initialize the Google Cloud CLI, run the `gcloud init` command.\n\nInstall Spanner migration tool\n------------------------------\n\nYou can install SMT using a Linux shell command or Google Cloud CLI: \n\n### Linux shell\n\nTo install SMT, run the following command: \n\n sudo apt-get install google-cloud-sdk-spanner-migration-tool\n\n### gcloud\n\nYou can install SMT by using the\n[`gcloud components install`](/sdk/gcloud/reference/components/install)\ncommand: \n\n gcloud components install spanner-migration-tool\n\nFor more information on installing SMT, see\n[Installing Spanner migration tool](https://googlecloudplatform.github.io/spanner-migration-tool/install.html#installing-spanner-migration-tool).\n\nAccess Spanner migration tool\n-----------------------------\n\nYou can use the\n[`gcloud alpha spanner migrate`](/sdk/gcloud/reference/alpha/spanner/migrate)\ncommand to access and use SMT.\n\nTo launch the SMT web UI, you can run the\nfollowing command: \n\n gcloud alpha spanner migrate web\n\nYou need to provide your Google Cloud credentials to allow\nSMT to access resources. Click\n`http://localhost:8080` on the response to the previous command to open the web\nUI.\n| **Note:** Keep the Google Cloud CLI tab open while you view the SMT web UI.\n\nConnect to Spanner\n------------------\n\nTo connect to Spanner using the SMT web UI, do the following:\n\n1. Click the edit button\n to configure the connection to Spanner.\n\n2. Specify the following information to connect to Spanner:\n\n - **Project ID**: the project ID where your Spanner instance is.\n - **Instance ID**: the Spanner instance ID.\n3. Click **Save**.\n\nConnect to your source database\n-------------------------------\n\nYou need to connect to the source database using the SMT\nweb UI by providing the following information:\n\n- **Database Engine**: specify whether your source database is MySQL, SQL Server, Oracle, or PostgreSQL.\n- **Hostname**: the IP address of your source database.\n- **Port**: the port where your source database is accessible.\n- **User name**: the username of the source database.\n- **Password**: the password of the source database.\n- **Spanner Dialect** : specify whether you want to use [GoogleSQL](/spanner/docs/reference/standard-sql/overview) or [PostgreSQL](/spanner/docs/reference/postgresql/overview).\n\nAfter entering the information you can connect to the source database by\nclicking **Test Connection** , and then clicking **Connect**.\n\nWhat's next?\n------------\n\n- [Migrate schema from MySQL](/spanner/docs/migrate-mysql-schema).\n- [Use Spanner migration tool for MySQL schema migration](/spanner/docs/migrate-schema-from-mysql-using-migration-tool)."]]