今天看见有个同学说使用帝国备份王的时候不能备份提示1.You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql -u root -p 123456' at line 1 mysql -u root -p 123456,2.You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 select * from `CHARACTER_SETS` limit 0。

产生原因:因为使用了高版本的SQL语句在低版本中导入,主要是可能用MYSQL4.1版本中的语句在MYSQL4.02中运行不同版本之间导入.

解决方面:升级MYSQL数据库到相应的对应版本或者:

程序代码
ENGINE=MyISAM DEFAULT CHARSET=latin1

或者程序代码
ENGINE=InnoDB DEFAULT CHARSET=latin1

全部替换为程序代码
ENGINE=MyISAM

可以将SQL文件分批COPY建立SQL文件,然后 分批导入.

这样方便查找具体是那个地方出错,如:

ERROR 1074 at line 1802: Too big column length for column 'Cjieshao' (max = 255. Use BLOB instead

说明文件字符长度超过当前版本. MYSQL4.0只支持255个,当高版本如MYSQL5.0导入时候就要注意

修改长度为255再导入就会正常

ERROR 1064 at line 3034: You have an error in your SQL syntax. Check the manua that corresponds to your MySQL server version for the right syntax to use near
'collate utf8_swedish_ci default NULL, PRIMARY KEY (`sshyid`)

解决方法: 去掉 'collate utf8_swedish_ci 就正常

.sql -u root -p密码