MySQL8长字符串建表失败

作者: spilledyear | 来源:发表于2018-04-23 14:34 被阅读11次

    在 创建表的时候, 字段太多, 其中包括 200个 text类型的字段,然后报错了

    Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
    
    Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 0 bytes is stored inline. 
    

    在网上查了一些自来哦,可以看看这个

    重要的一条信息就是要执行 以下命令

    SET GLOBAL innodb_file_format='Barracuda'; 
    

    但是在执行这个命令的时候报错了,报如信息如下:

    Unknown system variable 'innodb_file_format'
    

    最后 的解决方案,不确定是具体是改了哪一条,但是最后确实可以用了,mysql的配置文件如下:

    # Other default tuning values
    # MySQL Server Instance Configuration File
    # ----------------------------------------------------------------------
    # Generated by the MySQL Server Instance Configuration Wizard
    #
    #
    # Installation Instructions
    # ----------------------------------------------------------------------
    #
    # On Linux you can copy this file to /etc/my.cnf to set global options,
    # mysql-data-dir/my.cnf to set server-specific options
    # (@localstatedir@ for this installation) or to
    # ~/.my.cnf to set user-specific options.
    #
    # On Windows you should keep this file in the installation directory 
    # of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To
    # make sure the server reads the config file use the startup option 
    # "--defaults-file". 
    #
    # To run run the server from the command line, execute this in a 
    # command line shell, e.g.
    # mysqld --defaults-file="D:\GreenSoft\MySQL\my.ini"
    #
    # To install the server as a Windows service manually, execute this in a 
    # command line shell, e.g.
    # mysqld --install mysql --defaults-file="D:\GreenSoft\MySQL\my.ini"
    #
    # And then execute this in a command line shell to start the server, e.g.
    # net start mysql
    #
    #
    # Guildlines for editing this file
    # ----------------------------------------------------------------------
    #
    # In this file, you can use all long options that the program supports.
    # If you want to know the options a program supports, start the program
    # with the "--help" option.
    #
    # More detailed information about the individual options can also be
    # found in the manual.
    #
    # For advice on how to change settings please see
    # http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
    #
    #
    # CLIENT SECTION
    # ----------------------------------------------------------------------
    #
    # The following options will be read by MySQL client applications.
    # Note that only client applications shipped by MySQL are guaranteed
    # to read this section. If you want your own MySQL client program to
    # honor these values, you need to specify it as an option during the
    # MySQL client library initialization.
    #
    
    
    [client]
    no-beep
    
    # pipe
    # socket=0.0
    port=3306
    
    
    [mysql]
    
    default-character-set=utf8
    
    
    
    [mysqld]
    
    # These are commonly set, remove the # and set as required.
    character-set-server = utf8
    basedir = D:\GreenSoft\MySQL
    datadir = D:\GreenSoft\MySQL\data
    port = 3306
    server_id = 1
    
    
    
    # Remove leading # and set to the amount of RAM for the most important data
    # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
    innodb_buffer_pool_size = 128M
    
    # Remove leading # to turn on a very important data integrity option: logging
    # changes to the binary log between backups.
    # log_bin
    
    # General and Slow logging.
    log-output=FILE
    general-log=0
    general_log_file="CUPID.log"
    slow-query-log=1
    slow_query_log_file="CUPID-slow.log"
    long_query_time=10
    
    # Binary Logging.
    # log-bin
    
    # Error Logging.
    log-error="CUPID.err"
    
    
    
    # Remove leading # to set options mainly useful for reporting servers.
    # The server defaults are faster for transactions and fast SELECTs.
    # Adjust sizes as needed, experiment to find the optimal values.
    # join_buffer_size = 128M
    # sort_buffer_size = 2M
    # read_rnd_buffer_size = 2M 
    
    
    sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
    
    
    innodb_log_file_size = 512M
    binlog_format='MIXED'
    max_allowed_packet = 1G
    innodb_file_per_table = 1
    # innodb_file_format = Barracuda
    
    # 大小写是否敏感,0敏感 Linux下默认为0, Windows下默认值是 1, MacOS下默认值是 2(0敏感)
    lower_case_table_names = 1
    
    innodb_strict_mode = 0
    max_connections = 500
    
    

    相关文章

      网友评论

        本文标题:MySQL8长字符串建表失败

        本文链接:https://www.haomeiwen.com/subject/iiqllftx.html