Sebagian atau seluruh informasi di halaman ini mungkin tidak berlaku untuk Trusted Cloud dari S3NS. Lihat Perbedaan dari Google Cloud untuk mengetahui detail selengkapnya.
Di kolom URL Container image, masukkan phpmyadmin. Cloud Run menarik image dari Docker Hub publik.
Di kolom Nama layanan, masukkan phpmyadmin.
Periksa Require authentication.
Klik Container(s), volume, jaringan, keamanan
untuk menetapkan opsi berikut:
Di kolom Port, masukkan 80 untuk nilai port penampung.
Di Variabel lingkungan, tambahkan PMA_HOST dan tetapkan nilainya menjadi alamat IP internal instance Cloud SQL.
Di Networking, pilih Connect to a VPC for outbound traffic dan Send traffic directly to a VPC. Pilih jaringan yang sama dengan instance Cloud SQL.
Terhubung ke layanan menggunakan proxy Cloud Run
Untuk mengakses layanan yang dilindungi IAM secara aman, gunakan proxy developer Cloud Run.
Untuk memulai proxy pada layanan yang dibuat sebelumnya, gunakan perintah berikut:
gcloudrunservicesproxyphpmyadmin--port=8080
Jika gcloud CLI meminta Anda menginstal komponen cloud-run-proxy, masukkan Y.
Untuk menguji penyiapan, masukkan URL dan nomor port (misalnya, http://127.0.0.1:8080/),
lalu dengan nama pengguna (nama admin) dan sandi. Karena Anda
menggunakan proxy developer Cloud Run lokal untuk mengakses layanan
secara aman, Anda mungkin melihat pesan error, yang dapat diabaikan:
There is a mismatch between HTTPS indicated on the server and client.
Setelah menyelesaikan tutorial, Anda dapat membersihkan resource yang dibuat agar resource tersebut berhenti menggunakan kuota dan dikenai biaya. Bagian berikut menjelaskan cara menghapus atau menonaktifkan
resource ini.
Menghapus project
Cara termudah untuk menghilangkan penagihan adalah dengan menghapus project yang Anda
buat untuk tutorial.
Untuk menghapus project:
In the Trusted Cloud console, go to the Manage resources page.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-19 UTC."],[],[],null,["# Use phpMyAdmin with Cloud SQL on Cloud Run\n\n*** ** * ** ***\n\nThis guide show how to install [phpMyAdmin](https://docs.phpmyadmin.net/en/latest/intro.html) on Cloud Run. You can use phpMyAdmin to administer Cloud SQL over the web.\n\n\u003cbr /\u003e\n\nYou will find this tutorial helpful if you:\n\n- Host applications on Cloud Run.\n- Use [Cloud SQL](/sql/docs) as your database.\n- Want to use phpMyAdmin as an interface for MySQL or prefer a web interface for database administration.\n\nObjectives\n----------\n\n- Learn how to deploy phpMyAdmin on Cloud Run.\n\nCosts\n-----\n\nThis tutorial uses billable components of Google Cloud,\nincluding:\n\n- [Cloud Run](/run/pricing)\n- [Cloud SQL](/sql/pricing)\n\nTo generate a cost estimate based on your projected usage, use the [Pricing Calculator](/products/calculator). \nNew Cloud Platform users might be eligible for a Google Cloud [free trial](/free-trial). \n\n\u003cbr /\u003e\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-\n [Install](/sdk/docs/install) the [gcloud CLI](/sdk/gcloud).\n\n- If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n-\n To [initialize](/sdk/docs/initializing) the gcloud CLI, run the following command:\n\n ```bash\n gcloud init\n ```\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\n-\n [Install](/sdk/docs/install) the [gcloud CLI](/sdk/gcloud).\n\n- If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n-\n To [initialize](/sdk/docs/initializing) the gcloud CLI, run the following command:\n\n ```bash\n gcloud init\n ```\n\n1. Create a [Cloud SQL\n Second Generation instance](/sql/docs/mysql/create-instance#create-2nd-gen) with a [private IP](/sql/docs/mysql/configure-private-ip).\n2. Create a [database user](/sql/docs/mysql/create-manage-users#creating). \n\nCreate a service using the phpMyAdmin image\n-------------------------------------------\n\n### Console\n\n1. In the Google Cloud console, go to Cloud Run:\n\n [Go to Cloud Run](https://console.cloud.google.com/run)\n2. Select **Create service**.\n\n 1. In the **Container image** URL field, enter `phpmyadmin`. Cloud Run pulls the image from the public [Docker Hub](https://hub.docker.com/_/phpmyadmin).\n 2. In the **Service name** field, enter `phpmyadmin`.\n 3. Check `Require authentication`.\n 4. Click **Container(s), volumes, networking, security** to set the following options:\n 1. In the **Port** field, enter `80` for the value of the container port.\n 2. In **Environment variables** , add `PMA_HOST` and set the value to be the internal IP address of the Cloud SQL instance.\n 5. In **Networking** , select **Connect to a VPC for outbound traffic** and **Send traffic directly to a VPC**. Choose the same network as the Cloud SQL instance.\n\n | **Note:** You can also use a Serverless VPC Access instead of routing traffic directly to a VPC. In the [comparison table](/run/docs/configuring/connecting-vpc#comparison-table), learn the difference between the two ways.\n\nConnect to the service using Cloud Run proxy\n--------------------------------------------\n\nTo securely access the IAM-protected service, use the Cloud Run developer proxy.\n| **Important:** We don't recommend exposing phpMyAdmin to the public internet directly. If you prefer an alternative to the local proxy, you can configure [IAP](/iap/docs/enabling-cloud-run) to enforce user authentication.\n\n1. To start the proxy on the previously created service, use the following command:\n\n gcloud run services proxy phpmyadmin --port=8080\n\n If [gcloud CLI](/sdk/gcloud) prompts you to install the `cloud-run-proxy` components, then enter `Y`.\n2. To test the setup, enter the URL and port number (for example, `http://127.0.0.1:8080/`),\n and then with the username (admin name) and password. Since you're\n using the local Cloud Run developer proxy to access the service\n securely, you might see an error message, which can be ignored:\n `There is a mismatch between HTTPS indicated on the server and client`.\n\nTroubleshoot\n------------\n\nTo obtain information about Cloud Run errors, access the\n[Cloud Run logs](https://console.cloud.google.com/logs) in the [Google Cloud console](https://console.cloud.google.com/).\n\nClean up\n--------\n\n\nAfter you finish the tutorial, you can clean up the resources that you created so that they\nstop using quota and incurring charges. The following sections describe how to delete or turn off\nthese resources.\n\n\u003cbr /\u003e\n\n### Delete the project\n\n\nThe easiest way to eliminate billing is to delete the project that you\ncreated for the tutorial.\n\nTo delete the project:\n\n| **Caution** : Deleting a project has the following effects:\n|\n| - **Everything in the project is deleted.** If you used an existing project for the tasks in this document, when you delete it, you also delete any other work you've done in the project.\n| - **Custom project IDs are lost.** When you created this project, you might have created a custom project ID that you want to use in the future. To preserve the URLs that use the project ID, such as an `appspot.com` URL, delete selected resources inside the project instead of deleting the whole project.\n|\n|\n| If you plan to explore multiple architectures, tutorials, or quickstarts, reusing projects\n| can help you avoid exceeding project quota limits.\n1. In the Google Cloud console, go to the **Manage resources** page.\n\n [Go to Manage resources](https://console.cloud.google.com/iam-admin/projects)\n2. In the project list, select the project that you want to delete, and then click **Delete**.\n3. In the dialog, type the project ID, and then click **Shut down** to delete the project.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### Delete instances\n\n\nTo delete a Cloud SQL instance:\n\n1. In the Google Cloud console, go to the **Instances** page.\n\n [Go to Instances](https://console.cloud.google.com/sql/instances)\n2. Click the name of the SQL instance you that want to delete.\n3. To delete the instance, click delete **Delete**, and then follow the instructions.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nWhat's next\n-----------\n\n- [Learn more about phpMyAdmin](http://www.phpmyadmin.net/home_page/docs.php).\n- Explore reference architectures, diagrams, and best practices about Google Cloud. Take a look at our [Cloud Architecture Center](/architecture)."]]