首页 > 数据库技术 > 详细

mysql5.6 报错: ERROR 1709 (HY000): Index column size too large. The maximum column size is 767 bytes.

时间:2021-09-02 15:29:03      阅读:20      评论:0      收藏:0      [点我收藏+]

1.语句 (文章:https://segmentfault.com/a/1190000021131856)

mysql> CREATE TABLE permissions (
    ->     role varchar(50) NOT NULL,
    ->     resource varchar(512) NOT NULL,
    ->     action varchar(8) NOT NULL,
    ->     constraint uk_role_permission UNIQUE (role,resource,action)
    -> );
ERROR 1709 (HY000): Index column size too large. The maximum column size is 767 bytes.

2.步骤

mysql> show variables like ‘innodb_large_prefix‘;
+---------------------+-------+
| Variable_name       | Value |
+---------------------+-------+
| innodb_large_prefix | OFF   |
+---------------------+-------+
1 row in set (0.00 sec)

mysql> show variables like ‘innodb_file_format‘;
+--------------------+----------+
| Variable_name      | Value    |
+--------------------+----------+
| innodb_file_format | Antelope |
+--------------------+----------+
1 row in set (0.00 sec)

mysql> show variables like ‘innodb_file_per_table‘;
+-----------------------+-------+
| Variable_name         | Value |
+-----------------------+-------+
| innodb_file_per_table | ON    |
+-----------------------+-------+
1 row in set (0.00 sec)

mysql> set global innodb_large_prefix=‘on‘;
Query OK, 0 rows affected (0.00 sec)

mysql> set global innodb_file_format=‘Barracuda‘;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like ‘innodb_large_prefix‘;
+---------------------+-------+
| Variable_name       | Value |
+---------------------+-------+
| innodb_large_prefix | ON    |
+---------------------+-------+
1 row in set (0.00 sec)

mysql> show variables like ‘innodb_file_format‘;
+--------------------+-----------+
| Variable_name      | Value     |
+--------------------+-----------+
| innodb_file_format | Barracuda |
+--------------------+-----------+
1 row in set (0.00 sec)

mysql> CREATE TABLE permissions (
    ->     role varchar(50) NOT NULL,
    ->     resource varchar(512) NOT NULL,
    ->     action varchar(8) NOT NULL,
    ->     constraint uk_role_permission UNIQUE (role,resource,action)
    -> )  CHARSET=utf8 ROW_FORMAT=DYNAMIC;

mysql5.6 报错: ERROR 1709 (HY000): Index column size too large. The maximum column size is 767 bytes.

原文:https://www.cnblogs.com/Applogize/p/15217914.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!