mysql数据库应用开发_应用程序开发-Azure Database for MySQL | Microsoft Docs

您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

Azure Database for MySQL 应用程序开发概述Application development overview for Azure Database for MySQL

3/18/2020

本文内容

本文介绍开发人员为连接 Azure Database for MySQL 而编写应用程序代码时应遵循的设计注意事项。This article discusses design considerations that a developer should follow when writing application code to connect to Azure Database for MySQL.

提示

有关演示如何使用 workbench 和 mysql.exe 创建服务器、创建基于服务器的防火墙、查看服务器属性、创建数据库以及进行连接和查询的教程,请参阅设计首个 Azure Database for MySQL 数据库For a tutorial showing you how to create a server, create a server-based firewall, view server properties, create database, and connect and query by using workbench and mysql.exe, see Design your first Azure Database for MySQL database

语言和平台Language and platform

为各种编程语言和平台提供了代码示例。There are code samples available for various programming languages and platforms.

工具Tools

Azure Database for MySQL 使用 MySQL 社区版,此版本与 MySQL 常用管理工具(如 Workbench)或 MySQL 实用程序(如 mysql.exe)及 phpMyAdmin 和 Navicat 等工具兼容。Azure Database for MySQL uses the MySQL community version, compatible with MySQL common management tools such as Workbench or MySQL utilities such as mysql.exe, phpMyAdmin, Navicat, and others. 还可以使用 Azure 门户、Azure CLI 和 REST API 与数据库服务进行交互。You can also use the Azure portal, Azure CLI, and REST APIs to interact with the database service.

资源限制Resource limitations

Azure Database for MySQL 使用两种不同机制管理可用于服务器的资源:Azure Database for MySQL manages the resources available to a server by using two different mechanisms:

资源调控。Resources Governance.

强制实施限制。Enforcement of Limits.

安全性Security

Azure Database for MySQL 提供用于在 MySQL Database 中限制访问、保护数据、配置用户和角色及监视活动的资源。Azure Database for MySQL provides resources for limiting access, protecting data, configuring users and roles, and monitoring activities on a MySQL database.

身份验证Authentication

Azure Database for MySQL 支持用户和登录名这两种服务器身份验证方式。Azure Database for MySQL supports server authentication of users and logins.

复原能力Resiliency

如果在连接到 MySQL Database 时发生暂时性错误,代码应重试调用。When a transient error occurs while connecting to a MySQL database, your code should retry the call. 建议让重试逻辑使用退让逻辑,这样就不会因为多个客户端同时重试而对 SQL 数据库造成混乱。We recommend that the retry logic use back off logic so that it does not overwhelm the SQL database with multiple clients retrying simultaneously.

代码示例:有关演示重试逻辑的代码示例,请在以下位置参阅所选语言的示例:用于连接 Azure Database for MySQL 的连接库Code samples: For code samples that illustrate retry logic, see samples for the language of your choice at: Connectivity libraries used to connect to Azure Database for MySQL

管理连接Managing connections

数据库连接是一种受限资源,因此访问 MySQL Database 时,建议合理使用连接,以便实现更好的性能。Database connections are a limited resource, so we recommend sensible use of connections when accessing your MySQL database to achieve better performance.

使用连接池或永久性连接访问数据库。Access the database by using connection pooling or persistent connections.

使用短寿命连接访问数据库。Access the database by using short connection life span.

尝试连接时在应用程序中使用重试逻辑,以便捕获由于并发连接数达到允许的最大值而导致的失败。Use retry logic in your application at the point of the connection attempt to catch failures resulting from concurrent connections have reached the maximum allowed. 在重试逻辑中,设置较短延迟,并在进行更多连接尝试前等待随机的一段时间。In the retry logic, set a short delay, and then wait for a random time before the additional connection attempts.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值