Alcune o tutte le informazioni in questa pagina potrebbero non essere applicabili a Trusted Cloud di S3NS. Per ulteriori dettagli, consulta la sezione Differenze rispetto a Google Cloud.
Nel campo URL Immagine container, inserisci phpmyadmin. Cloud Run esegue il pull dell'immagine da Docker Hub pubblico.
Nel campo Nome servizio, inserisci phpmyadmin.
Controlla Require authentication.
Fai clic su Container, volumi, networking, sicurezza
per impostare le seguenti opzioni:
Nel campo Porta, inserisci 80 come valore della porta del container.
In Variabili di ambiente, aggiungi PMA_HOST e imposta il valore in modo che sia l'indirizzo IP interno dell'istanza Cloud SQL.
In Networking, seleziona Connettiti a un VPC per il traffico in uscita e Invia il traffico direttamente a un VPC. Scegli la stessa rete dell'istanza Cloud SQL.
Connettiti al servizio utilizzando il proxy Cloud Run
Per accedere in modo sicuro al servizio protetto da IAM, utilizza il proxy per sviluppatori Cloud Run.
Per avviare il proxy sul servizio creato in precedenza, utilizza il seguente comando:
gcloudrunservicesproxyphpmyadmin--port=8080
Se gcloud CLI ti chiede di installare i componenti cloud-run-proxy, inserisci Y.
Per testare la configurazione, inserisci l'URL e il numero di porta (ad esempio http://127.0.0.1:8080/),
quindi il nome utente (nome amministratore) e la password. Poiché utilizzi il proxy per sviluppatori Cloud Run locale per accedere al servizio in modo sicuro, potresti visualizzare un messaggio di errore, che può essere ignorato: There is a mismatch between HTTPS indicated on the server and client.
Al termine del tutorial, puoi eliminare le risorse che hai creato in modo che non utilizzino più la quota generando addebiti. Le seguenti sezioni descrivono come eliminare o disattivare
queste risorse.
Elimina il progetto
Il modo più semplice per eliminare la fatturazione è eliminare il progetto creato per il tutorial.
Per eliminare il progetto:
In the Trusted Cloud console, go to the Manage resources page.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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)."]]