row_format 不能为 FIXED。lower_case_table_names 变量必须一致。max_allowed_packet 参数设置至少为4M。connect_timeout 必须大于10。row_format 的取值为 FIXED 时,表格中每行的存储长度超过限制值时会溢出,发生报错。因此需要修改为其他模式,如 DYNAMIC,使每行的存储长度会随内容的长度而变化。 row_format 参数为 DYNAMIC。 alter table table_name row_format = DYNAMIC
show table status like '%row_format%';
mysql> show table status like '%row_format%';+---------------+----------+| Variable_name | Value |+---------------+----------+| row_format | DYNAMIC |+---------------+----------+1 row in set (0.00 sec)
lower_case_table_names 是 MySQL 设置大小写是否敏感的一个参数,不同的取值情况如下:
Windows 或 macOS 环境对大小写是不敏感的,但是 Linux 环境却是敏感的,为了保证不同系统的兼容性,需要将大小写敏感规则设置统一。lower_case_table_names 取值。show variables like '%lower_case_table_names%';
lower_case_table_names 参数。alter global lower_case_table_names = 1
[\\$Mysql_Dir]/bin/mysqladmin -u root -p shutdown[\\$Mysql_Dir]/bin/safe_mysqld &
show variables like '%lower_case_table_names%';
mysql> show variables like '%lower_case_table_names%';+------------------------+-------+| Variable_name | Value |+------------------------+-------+| lower_case_table_names | 1 |+------------------------+-------+1 row in set (0.00 sec)
max_allowed_packet 为最大允许的传输包。设置太大,会使用更多内存导致丢包,无法捕捉异常大事物包 SQL;设置太小,可能会导致程序报错,备份失败,也会导致频繁的收发网络报,影响系统性能。max_allowed_packet 参数。 set global max_allowed_packet = 4M
show global variables like '%max_allowed_packet%';
mysql> show global variables like '%max_allowed_packet%';+------------------------+---------+| Variable_name | Value |+------------------------+---------+| max_allowed_packet | 4194304 |+------------------------+---------+1 row in set (0.00 sec)
connect_timeout 为数据库的连接时间,超过 connect_timeout 设置值的连接请求将会被拒绝。如果设置过小,会导致数据库连接频繁断开,影响处理效率,因此建议该参数取值大于10。connect_timeout 参数。set global connect_timeout = 10
show global variables like '%connect_timeout%';
mysql> show global variables like '%connect_timeout%';+------------------------+-------+| Variable_name | Value |+------------------------+-------+| connect_timeout | 10 |+------------------------+-------+1 row in set (0.00 sec)
文档反馈