当前位置: 首页 > MySQL数据库

Mysql相关技术举例分析

时间:2026-01-28 14:10:40

1.复制过滤问题:
 --replicate-do-db=db_name:
USE prices;
UPDATE sales.january SET amount=amount+1000;
Statement-based replication:对于基于语句级的复制(或mixed级别),replicate_do_db这个参数指的是默认的数据库,即当前使用的数据库(use database),在默认数据库下更新replicate_do_db指定的数据库,从库不会随之更新,会有问题
解决:对于binlog_format=statement或mixed,只在从库设置replicate_wild_do_table= sales.%或replicate_wild_ignore_table即可。此时可以避免跨库更新问题。
对于binlog_format=statement或mixed,只在从库设置replicate_wild_do_table= quyou.%或replicate_wild_ignore_table即可。此时可以避免跨库更新问题。
对于binlog_format=statement或mixed,只在从库设置replicate_wild_do_table= quyou.%或replicate_wild_ignore_table即可。此时可以避免跨库更新问题。
Row-based replication:不存在问题


2.InnoDB单列索引长度不能超过767bytes限制问题
实际上联合索引还有一个限制是3072:
By default, the index key prefix length limit is 767 byte
When the innodb_large_prefix configuration option is enabled, the index key prefix length limit is raised to 3072 bytes for InnoDB tables that use DYNAMIC or COMPRESSED row format.
The limits that apply to index key prefixes also apply to full-column index keys.
If you reduce the InnoDB page size to 8KB or 4KB by specifying the innodb_page_size option when creating the MySQL instance, the maximum length of the index key is lowered proportionally, based on the limit of 3072 bytes for a 16KB page size. That is, the maximum index key length is 1536 bytes when the page size is 8KB, and 768 bytes when the page size is 4KB.

解决:
MySQL 5.5.14及其后版本解决了最大767字节索引长度的问题,引入了innodb_large_prefix配置关键字。这项关键字必须配合innodb_file_format和innodb_file_per_table
innodb_large_prefix = True
innodb_file_format = Barracuda
innodb_file_per_table = True

Barracuda 在原来的基础上(Antelope)新增了Dynamic和Compressed两种行格式。


上一篇:怎么解决mysql的Warning问题
下一篇:MySQL 5.7.9 GA稳定版新特性有哪些
mysql
  • 英特尔与 Vertiv 合作开发液冷 AI 处理器
  • 英特尔第五代 Xeon CPU 来了:详细信息和行业反应
  • 由于云计算放缓引发扩张担忧,甲骨文股价暴跌
  • Web开发状况报告详细介绍可组合架构的优点
  • 如何使用 PowerShell 的 Get-Date Cmdlet 创建时间戳
  • 美光在数据中心需求增长后给出了强有力的预测
  • 2027服务器市场价值将接近1960亿美元
  • 生成式人工智能的下一步是什么?
  • 分享在外部存储上安装Ubuntu的5种方法技巧
  • 全球数据中心发展的关键考虑因素
  • 英特尔与 Vertiv 合作开发液冷 AI 处理器

    英特尔第五代 Xeon CPU 来了:详细信息和行业反应

    由于云计算放缓引发扩张担忧,甲骨文股价暴跌

    Web开发状况报告详细介绍可组合架构的优点

    如何使用 PowerShell 的 Get-Date Cmdlet 创建时间戳

    美光在数据中心需求增长后给出了强有力的预测

    2027服务器市场价值将接近1960亿美元

    生成式人工智能的下一步是什么?

    分享在外部存储上安装Ubuntu的5种方法技巧

    全球数据中心发展的关键考虑因素