zoukankan      html  css  js  c++  java
  • mysql 数据库执行创建索引语句异常 Specified key was too long; max key length is 767 bytes

    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

    重启数据库。

    再次执行脚本。

  • 相关阅读:
    Java debug技术
    mybatis-generator插件
    JVM常见问题
    Java安全之Access control
    JVM新生代各个区的比例问题
    宣告
    退役啦!
    NOIP 2018退役祭
    自定义博客园模板
    带花树算法
  • 原文地址:https://www.cnblogs.com/a393060727/p/13303889.html
Copyright © 2011-2022 走看看