我用:
1.导出:mysqldump --opt database > backup-file.sql
2.导入:mysqladmin create target_db_name
操作完以后,sql脚本里面就变化了 字段1 mediumtext NOT NULL DEFAULT '' 变成了字段1 mediumtext NOT NULL ,少了DEFAULT ''
用程序操作数据库,增加的时候报了以下错误。
java.sql.SQLException: Field 'opinion' doesn't have a default value
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3170)
at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1316)
at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1235)
at include.nseer_db.nseer_db_backup1.executeUpdate(nseer_db_backup1.java
:117)
at design.file.register_ok.service(register_ok.java:219)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:188)
at include.anti_repeat_submit.SubmitFilter.doFilter(SubmitFilter.java:11
3)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:151)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcesso
r.java:834)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.pr
ocess(Http11AprProtocol.java:640)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:12
86)
at java.lang.Thread.run(Thread.java:595)