您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.
快速入门:使用 PHP 连接到 Azure Database for MySQL 并查询其中的数据Quickstart: Use PHP to connect and query data in Azure Database for MySQL
10/28/2020
本文内容
本快速入门演示了如何使用 PHP 应用程序连接到 Azure Database for MySQL。This quickstart demonstrates how to connect to an Azure Database for MySQL using a PHP application. 同时还介绍了如何使用 SQL 语句在数据库中查询、插入、更新和删除数据。It shows how to use SQL statements to query, insert, update, and delete data in the database.
先决条件Prerequisites
对于本快速入门,你需要:For this quickstart you need:
具有活动订阅的 Azure 帐户。An Azure account with an active subscription.
使用 Azure 门户创建 Azure Database for MySQL 单一服务器Create an Azure Database for MySQL single server using Azure portal
或 Azure CLI 创建 Azure Database for PostgreSQL 单一服务器(如果没有)。or Azure CLI if you do not have one.
请完成以下操作之一以启用连接,具体取决于你使用的是公共访问还是私有访问。Based on whether you are using public or private access, complete ONE of the actions below to enable connectivity.
操作Action
连接方法Connectivity method
操作指南How-to guide
配置防火墙规则Configure firewall rules
公用Public
配置服务终结点Configure Service Endpoint
公用Public
配置专用链接Configure private link
PrivatePrivate
备注
在本快速入门中,我们使用 MySQLi 库来管理连接和查询服务器。We are using MySQLi library to manage connect and