导入转储文件的时候:Error Code: 1406. Data too long for column - MySQL

Posted 张五飞

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了导入转储文件的时候:Error Code: 1406. Data too long for column - MySQL相关的知识,希望对你有一定的参考价值。

mysql will truncate any insert value that exceeds the specified column width.

to make this without error try Switch your MySQL mode to not use STRICT.

here some docs


EDIT:

To change the mode

This can be done in two ways:

  1. Open your "my.ini" file within the MySQL installation directory, and look for the text "sql-mode".

Find:

Code:

# Set the SQL mode to strict 
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Replace with:

Code:

# Set the SQL mode to strict 
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Or

  1. You can run an SQL query within your database management tool, such as phpMyAdmin:

Code:

SET @@global.sql_mode= ‘‘;

以上是关于导入转储文件的时候:Error Code: 1406. Data too long for column - MySQL的主要内容,如果未能解决你的问题,请参考以下文章

Error Code: 2006 - MySQL 鏈嶅姟鍣ㄥ凡绂荤嚎

导入大 sql 转储时出现 PHPMYADMIN 错误

在mac上用Xcode写程序, run的时候总是失败, 显示clang: error: linker command failed with exit code 1

mysql数据库导入sql文件时提示“Error Code: 1153 - Got a packet bigger than 'max_allowed_packet' bytes”解决

sqlite数据导入mysql

可以在命令行中导入使用 phpMyAdmin 创建的 MySQL 数据库转储吗?