Dans le champ URL de l'image du conteneur, saisissez phpmyadmin. Cloud Run extrait l'image du Docker Hub public.
Dans le champ Service name (Nom du compte de service), saisissez phpmyadmin.
Consultez Require authentication.
Cliquez sur Conteneur(s), volumes, mise en réseau, sécurité pour définir les options suivantes :
Dans le champ Port, saisissez 80 pour la valeur du port du conteneur.
Dans Variables d'environnement, ajoutez PMA_HOST et définissez la valeur sur l'adresse IP interne de l'instance Cloud SQL.
Dans Mise en réseau, sélectionnez Se connecter à un VPC pour le trafic sortant et Envoyer le trafic directement vers un VPC. Choisissez le même réseau que l'instance Cloud SQL.
Se connecter au service à l'aide du proxy Cloud Run
Pour accéder de manière sécurisée au service protégé par IAM, utilisez le proxy de développement Cloud Run.
Pour démarrer le proxy sur le service créé précédemment, utilisez la commande suivante :
gcloudrunservicesproxyphpmyadmin--port=8080
Si la gcloud CLI vous invite à installer les composants cloud-run-proxy, saisissez Y.
Pour tester la configuration, saisissez l'URL et le numéro de port (par exemple, http://127.0.0.1:8080/), puis le nom d'utilisateur (nom de l'administrateur) et le mot de passe. Étant donné que vous utilisez le proxy de développement Cloud Run local pour accéder au service de manière sécurisée, vous pouvez voir un message d'erreur, que vous pouvez ignorer : There is a mismatch between HTTPS indicated on the server and client.
Une fois le tutoriel terminé, vous pouvez procéder au nettoyage des ressources que vous avez créées afin qu'elles ne soient plus comptabilisées dans votre quota et qu'elles ne vous soient plus facturées. Dans les sections suivantes, nous allons voir comment supprimer ou désactiver ces ressources.
Supprimer le projet
Le moyen le plus simple d'empêcher la facturation est de supprimer le projet que vous avez créé pour ce tutoriel.
Pour supprimer le projet :
In the Trusted Cloud console, go to the Manage resources page.
Découvrez des architectures de référence, des schémas et des bonnes pratiques concernant Google Cloud.
Consultez notre Cloud Architecture Center.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/08/19 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 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)."]]