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

    重启数据库。

    再次执行脚本。

  • 相关阅读:
    Asible——inventory与大项目管理
    Asible——template
    Ansible——文件管理
    Ansible——处理任务失败
    Ansible——handlers与notify
    ubuntu 16.04 LTS 开发环境的安装及常用软件
    curl 命令详解
    VMware虚拟机三种网络模式详解
    ubantu 16.04 安装有道词典
    OneNote 使用汇总
  • 原文地址:https://www.cnblogs.com/a393060727/p/13303889.html
Copyright © 2011-2022 走看看