Specified key was too long; max key length is 767 bytes
Index column size too large. The maximum column size is 767 bytes.
进入到mysql安装数据库目录,找到my.cnf文件
vi /etc/mysql/my.cnf
在[mysqld]下加入以下配置:
innodb_file_format=barracuda
innodb_file_per_table=true
innodb_large_prefix=true
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
max_allowed_packet=500M
修改后配置:
[mysqld]
user=mysql
# 字符集
character-set-server=utf8
default_authentication_plugin=mysql_native_password
#sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql_mode=STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
# 连接数
max_connections=1500
# 不区分大小写
lower_case_table_names=1
# 解决问题 maximum column size is 767 bytes.
innodb_file_format=barracuda
innodb_file_per_table=true
innodb_large_prefix=true
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
max_allowed_packet=500M
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
重启数据库。
再次执行脚本。