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

    重启数据库。

    再次执行脚本。

  • 相关阅读:
    Oracle中的序列
    Oracle中常见表与各类结构的查询
    软件项目中的沟通 第一故事
    bat脚本 得到前一天的日期
    Windows bat脚本的for语句
    Integer与int比较
    String参数传递
    数据类型转换
    synchronized
    Java的Thread和Runnable
  • 原文地址:https://www.cnblogs.com/a393060727/p/13303889.html
Copyright © 2011-2022 走看看