今天想把blog的数据库换一个mysql5.0.83版本,操作时,遇到一个问题:
源库:
mysqldump -uroot –p*** wordpress > wordpress.sql
通过FTP传到目标主机
mysql> source wordpress.sql
ERROR 1064 (42000): 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
‘——————————————————-
另外执行都正确的,只有一条建表sql没有成功,为什么会报错?
的确少一张表,本来有12张的。
mysql> show tables;
+———————–+
| Tables_in_wordpress |
+———————–+
| tmp_wp_term_taxonomy |
| wp_comments |
| wp_links |
| wp_options |
| wp_postmeta |
| wp_posts |
| wp_term_relationships |
| wp_term_taxonomy |
| wp_terms |
| wp_usermeta |
| wp_users |
+———————–+
11 rows in set (0.01 sec)# more wordpress.sql
– MySQL dump 8.23
–
– Host: localhost Database: wordpress
——————————————————— 虚线要注意
– Server version 5.0.27-Comsenz–
– Table structure for table `tmp_wp_term_taxonomy`
–CREATE TABLE tmp_wp_term_taxonomy (
term_taxonomy_id bigint(20) unsigned NOT NULL default ’0′,
term_id bigint(20) unsigned NOT NULL default ’0′,
taxonomy varchar(32) character set utf8 NOT NULL default ”,
description longtext character set utf8 NOT NULL,
parent bigint(20) unsigned NOT NULL default ’0′,
count bigint(20) NOT NULL default ’0′
) ENGINE=MyISAM DEFAULT CHARSET=gbk;
第一条建表的sql语法也没错,后来发现是“虚线”惹的祸
# vi wordpress.sql
———————————————————
– MySQL dump 8.23
–
– Host: localhost Database: wordpress
– Server version 5.0.27-Comsenz
删除这里的虚线,执行就成功了
–
– Table structure for table `tmp_wp_term_taxonomy`
–执行就成功了!
Pingback: MySQL数据库的例外处理测试 – IT技术博客大全