$mysql -uroot -pWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 4708773Server version: 5.6.16.12-20161009-log Source distribution Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.mysql> CREATE TABLE `cc` ( -> `id` int(11) NOT NULL AUTO_INCREMENT, -> `c` varchar(255) DEFAULT NULL, -> PRIMARY KEY (`id`), -> KEY `idx_c` (`c`) -> ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;Query OK, 0 rows affected, 1 warning (0.01 sec) mysql> show warnings;+---------+------+---------------------------------------------------------+| Level | Code | Message |+---------+------+---------------------------------------------------------+| Warning | 1071 | Specified key was too long; max key length is 767 bytes |+---------+------+---------------------------------------------------------+1 row in set (0.00 sec) mysql> show create table cc\G*************************** 1. row *************************** Table: ccCreate Table: CREATE TABLE `cc` ( `id` int(11) NOT NULL AUTO_INCREMENT, `c` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `idx_c` (`c`(191))) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb41 row in set (0.00 sec)mysql> show global variables like "innodb_large_prefix";+---------------------+-------+| Variable_name | Value |+---------------------+-------+| innodb_large_prefix | OFF |+---------------------+-------+1 row in set (0.00 sec)复制代码
$mysql -uroot -pEntry Port ==== 3313Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 9304Server version: 5.7.13.1-AliSQL-20160928-log Source distribution Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. root@test 02:23:11>CREATE TABLE `cc` ( -> `id` int(11) NOT NULL AUTO_INCREMENT, -> `c` varchar(255) DEFAULT NULL, -> PRIMARY KEY (`id`), -> KEY `idx_c` (`c`) -> ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;Query OK, 0 rows affected (0.00 sec) root@test 02:25:46>show warnings;Empty set (0.00 sec) root@test 02:26:17>show global variables like "innodb_large_prefix";+---------------------+-------+| Variable_name | Value |+---------------------+-------+| innodb_large_prefix | ON |+---------------------+-------+1 row in set (0.00 sec) root@test 02:28:43>复制代码