azure mysql 字符集_配置服务器参数 - Azure 门户 - Azure Database for MySQL | Microsoft Docs...

本文介绍了如何使用Azure门户在Azure Database for MySQL中配置服务器参数,包括字符集设置。通过服务器参数页面可以调整特定设置,并使用init_connect在连接级别设置参数。此外,还讲解了填充时区表的方法和如何设置全局及会话级别的时区。
摘要由CSDN通过智能技术生成

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

使用 Azure 门户在 Azure Database for MySQL 中配置服务器参数Configure server parameters in Azure Database for MySQL using the Azure portal

10/1/2020

本文内容

用于 MySQL 的 Azure 数据库支持配置某些服务器参数。Azure Database for MySQL supports configuration of some server parameters. 本文介绍如何使用 Azure 门户配置这些参数。This article describes how to configure these parameters by using the Azure portal. 并非所有服务器参数都可调整。Not all server parameters can be adjusted.

备注

Server parameters can be updated globally at the server-level, use the Azure CLI, PowerShell, or Azure portal.

配置服务器参数Configure server parameters

登录到 Azure 门户,然后找到 Azure Database for MySQL 服务器。Sign in to the Azure portal, then locate your Azure Database for MySQL server.

在“设置”部分下,单击“服务器参数”,打开 Azure Database for MySQL 服务器的“服务器参数”页。Under the SETTINGS section, click Server parameters to open the server parameters page for the Azure Database for MySQL server.

9bdf8d2ccb73edd9aa3ce925f444f84c.png

定位需要调整的任何设置。Locate any settings you need to adjust. 查看“说明”列,了解用途和允许的值。Review the Description column to understand the purpose and allowed values.

ac8bc9b2f65f4e2446b98cd7b68aa7f9.png

单击“保存”,保存更改。Click Save to save your changes.

49a4c9d1f9ab87dda6eee23156700664.png

保存参数的新值后,随时可以通过选择“全部重置为默认设置”,将所有设置还原为默认值。If you have saved new values for the parameters, you can always revert everything back to the default values by selecting Reset all to default.

6dd456dcf081c9e8b9823a81f1d66415.png

设置参数未列出Setting parameters not listed

如果 Azure 门户中未列出你要更新的服务器参数,则可以选择性地使用 init_connect 在连接级别设置参数。If the server parameter you want to update is not listed in the Azure portal, you can optionally set the parameter at the connection level using init_connect. 此项可为每个连接到服务器的客户端设置服务器参数。This sets the server parameters for each client connecting to the server.

在“设置”部分下,单击“服务器参数”,打开 Azure Database for MySQL 服务器的“服务器参数”页。Under the SETTINGS section, click Server parameters to open the server parameters page for the Azure Database for MySQL server.

搜索 init_connectSearch for init_connect

在 value 列的 value 中添加服务器参数,格式为 SET parameter_name=YOUR_DESIRED_VALUE。Add the server parameters in the format: SET parameter_name=YOUR_DESIRED_VALUE in value the value column.

例如,可以通过将 init_connect 设置为 SET character_set_client=utf8;SET character_set_database=utf8mb4;SET character_set_connection=latin1;SET character_set_results=latin1; 来更改服务器的字符集For example, you can change the character set of your server by setting of init_connect to SET character_set_client=utf8;SET character_set_database=utf8mb4;SET character_set_connection=latin1;SET character_set_results=latin1;

以保存更改。Click Save to save your changes.

备注

init_connect 可用于在会话级别更改无需 SUPER 权限的参数。init_connect can be used to change parameters that do not require SUPER privilege(s) at the session level. 若要验证是否可以使用 init_connect 设置参数,请执行 set session parameter_name=YOUR_DESIRED_VALUE; 命令,如果出现“拒绝访问;需要 SUPER 权限”错误,则无法使用“init_connect”设置参数。To verify if you can set the parameter using init_connect, execute the set session parameter_name=YOUR_DESIRED_VALUE; command and if it errors out with Access denied; you need SUPER privileges(s) error, then you cannot set the parameter using `init_connect'.

使用时区参数Working with the time zone parameter

填充时区表Populating the time zone tables

可以通过从 MySQL 命令行或 MySQL Workbench 等工具调用 mysql.az_load_timezone 存储过程,填充服务器上的时区表。The time zone tables on your server can be populated by calling the mysql.az_load_timezone stored procedure from a tool like the MySQL command line or MySQL Workbench.

备注

如果正在运行 MySQL Workbench 中的 mysql.az_load_timezone 命令,可能需要先使用 SET SQL_SAFE_UPDATES=0; 关闭安全更新模式。If you are running the mysql.az_load_timezone command from MySQL Workbench, you may need to turn off safe update mode first using SET SQL_SAFE_UPDATES=0;.

CALL mysql.az_load_timezone();

重要

应重启服务器,确保正确填充时区表。You should restart the server to ensure the time zone tables are properly populated. 要重启服务器,请使用 Azure 门户或 CLI。To restart the server, use the Azure portal or CLI.

要查看可用的时区值,请运行以下命令:To view available time zone values, run the following command:

SELECT name FROM mysql.time_zone_name;

设置全局级时区Setting the global level time zone

可以从 Azure 门户中的“服务器参数”页设置全局级时区。The global level time zone can be set from the Server parameters page in the Azure portal. 下面将全局时区值设置为“美国/太平洋”。The below sets the global time zone to the value "US/Pacific".

2fb1daa0a2ff5c7d4ce4947d2cd36197.png

设置会话级时区Setting the session level time zone

可以通过从 MySQL 命令行或 MySQL Workbench 等工具运行 SET time_zone 命令来设置会话级时区。The session level time zone can be set by running the SET time_zone command from a tool like the MySQL command line or MySQL Workbench. 以下示例将时区设置为“美国/太平洋”时区。The example below sets the time zone to the US/Pacific time zone.

SET time_zone = 'US/Pacific';

若要了解日期和时间函数,请参阅 MySQL 文档。Refer to the MySQL documentation for Date and Time Functions.

后续步骤Next steps

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值