mysql的Data truncation怎么解决? Data truncated for column 'Pri...
MySQL\u4e2d\u7684Data truncation\u9519\u8bef\u63d0\u793a\u6c42\u52a9\u770b\u4f60\u63d2\u5165\u503c\u7684\u8303\u56f4 \u5b9a float\u7684\u6574\u6570\u4f4d\u548c\u5c0f\u6570\u4f4d.
\u89e3\u51b3\u65b9\u6cd5\u5982\u4e0b\uff1a
\u4e00\u3001\u68c0\u67e5\u662f\u5426\u4e71\u7801\u3002\u66f4\u6539\u7edf\u4e00\u7684\u5b57\u7b26\u7c7b\u578b\uff0c\u6bd4\u5982\u66f4\u6539\u5b57\u7b26\u7c7b\u578b\u4e3autf8\uff1b
\u4e8c\u3001\u5982\u679c\u662f Enum\uff0c\u5219\u53ef\u80fd\u662f\u6dfb\u52a0\u7684\u5b57\u7b26\u4e0d\u5728enum\u7c7b\u578b\u8303\u56f4\u5185\uff1b
\u4e09\u3001\u53ef\u80fd\u662f\u5728alter table\u66f4\u6539\u5217\u8bbe\u7f6e\u65f6\uff0c\u5f71\u54cd\u539f\u6765\u5b58\u5165\u7684\u503c\uff0c\u8fd9\u65f6\u53ef\u5c06\u539f\u503cupdate\u4e3a\u9700\u8981\u7684\u7c7b\u578b\u503c\u6216\u5220\u9664\u8fd9\u4e9b\u539f\u503c\u518dalter table\u3002
\u56db\u3001\u68c0\u67e5\u662f\u4e0d\u662f\u6570\u636e\u7c7b\u578b\u7684\u957f\u5ea6\u4e0d\u4e00\u81f4\u5bfc\u81f4\u7684\u3002\u8fd9\u4e2a\u6bd4\u8f83\u9ebb\u70e6\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a
1\u3001\u7a0b\u5e8f\u4e2d\u68c0\u67e5\u65e5\u671f\u7684\u8303\u56f4\uff0c\u5f53\u8d85\u51fa\u65f6\u7ed9\u51fa\u63d0\u793a\u6216\u5176\u4ed6\u5904\u7406
2\u3001\u627e\u5230mysql \u5b89\u88c5\u76ee\u5f55\u7684 my.ini
3\u3001\u627e\u5230sql-mode=\u201dSTRICT_TRANS_TABLES,NO_AUTO_Create_USER,NO_ENGINE_SUBSTITUTION\u201d\u628a\u5176\u4e2d\u7684 STRICT_TRANS_TABLES,\u53bb\u6389,\u7136\u540e\u91cd\u542fmysql\u3002
\u6b64\u5916\u5728\u5199\u65e5\u671f\u7c7b\u578b\u65f6\u4e5f\u8981\u6ce8\u610f\uff0cmysql \u7684date\u7c7b\u578b \u7684\u652f\u6301\u8303\u56f4\u662f1000-01-01\u52309999-12-31\uff0cdatetime\u7c7b\u578b\u7684\u652f\u6301\u8303\u56f4\u662f1000-01-01 00:00:00 \u5230 9999-12-31 23:59:59\u3002\u5982\u679c\u5c1d\u8bd5\u628a\u8d85\u51fa\u8303\u56f4\u7684\u503c\u63d2\u5165\u6570\u636e\u5e93\u4e2d\uff0c\u5219\u4f1a\u62a5\u6807\u9898\u4e2d\u7684\u9519\u8bef\u3002\u91c7\u7528datetime\u7c7b\u578b\u7684\u65f6\u5019\uff0c\u5f53\u65e5\u671f\u8d85\u51fa\u8303\u56f4\u65f6\uff0c\u63d2\u5165\u6570\u636e\u5e93\u65f6\u4e0d\u62a5\u9519\uff0c\u4f46\u4f1a\u662f\u4e00\u4e2a0000-00-00 \u6216\u80050000-00-00 00:00:00
\u6269\u5c55\u8d44\u6599\uff1a
MySQL\u662f\u4e00\u4e2a\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff0c\u7531\u745e\u5178MySQL AB \u516c\u53f8\u5f00\u53d1\uff0c\u76ee\u524d\u5c5e\u4e8e Oracle \u65d7\u4e0b\u4ea7\u54c1\u3002MySQL \u662f\u6700\u6d41\u884c\u7684\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u4e4b\u4e00\uff0c\u5728 WEB \u5e94\u7528\u65b9\u9762\uff0cMySQL\u662f\u6700\u597d\u7684 RDBMS (Relational Database Management System\uff0c\u5173\u7cfb\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf) \u5e94\u7528\u8f6f\u4ef6\u3002
MySQL\u662f\u4e00\u79cd\u5173\u7cfb\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff0c\u5173\u7cfb\u6570\u636e\u5e93\u5c06\u6570\u636e\u4fdd\u5b58\u5728\u4e0d\u540c\u7684\u8868\u4e2d\uff0c\u800c\u4e0d\u662f\u5c06\u6240\u6709\u6570\u636e\u653e\u5728\u4e00\u4e2a\u5927\u4ed3\u5e93\u5185\uff0c\u8fd9\u6837\u5c31\u589e\u52a0\u4e86\u901f\u5ea6\u5e76\u63d0\u9ad8\u4e86\u7075\u6d3b\u6027\u3002
MySQL\u6240\u4f7f\u7528\u7684 SQL \u8bed\u8a00\u662f\u7528\u4e8e\u8bbf\u95ee\u6570\u636e\u5e93\u7684\u6700\u5e38\u7528\u6807\u51c6\u5316\u8bed\u8a00\u3002MySQL \u8f6f\u4ef6\u91c7\u7528\u4e86\u53cc\u6388\u6743\u653f\u7b56\uff0c\u5206\u4e3a\u793e\u533a\u7248\u548c\u5546\u4e1a\u7248\uff0c\u7531\u4e8e\u5176\u4f53\u79ef\u5c0f\u3001\u901f\u5ea6\u5feb\u3001\u603b\u4f53\u62e5\u6709\u6210\u672c\u4f4e\uff0c\u5c24\u5176\u662f\u5f00\u653e\u6e90\u7801\u8fd9\u4e00\u7279\u70b9\uff0c\u4e00\u822c\u4e2d\u5c0f\u578b\u7f51\u7ad9\u7684\u5f00\u53d1\u90fd\u9009\u62e9 MySQL \u4f5c\u4e3a\u7f51\u7ad9\u6570\u636e\u5e93\u3002
\u7531\u4e8e\u5176\u793e\u533a\u7248\u7684\u6027\u80fd\u5353\u8d8a\uff0c\u642d\u914d PHP \u548c Apache \u53ef\u7ec4\u6210\u826f\u597d\u7684\u5f00\u53d1\u73af\u5883\u3002
\u53c2\u8003\u8d44\u6599\uff1a
MySQL\u5b98\u65b9API\u63a5\u53e3-Chapter 9 Language Structure
\u767e\u5ea6\u767e\u79d1-MySQL
插如数据到mysql中:在页面上加入本页的编码方式
<%@ page contentType= "text/html;charset=gb2312 " %>
把你要插入的中文文字由gb2312转变为iso-8859 。
扩展阅读:mysql update from ... mysql order by ... mysql having ... mysql truncate ... mysql group by ... mysql limit offset ... mysql ibdata1 ... mysql datetime ... mysql using ...