0

我准备了一个 sql 文件,并将包含在文件中,如下所示。

INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`)
VALUES('siteurl','http://localhost/TantraProjects/Ranjit/nt_plugin','yes'),
('blogname','NT PLUGIN','yes'),
('blogdescription','Just another WordPress site','yes'),
('users_can_register','0','yes'),
('admin_email','ranjit.pradhan@nettantra.com','yes'),
('start_of_week','1','yes'),
('use_balanceTags','0','yes'),
('use_smilies','1','yes'),
('require_name_email','1','yes'),
('comments_notify','1','yes'),
('posts_per_rss','10','yes'),
('rss_use_excerpt','0','yes'),
('mailserver_url','mail.example.com','yes'),
('mailserver_login','login@example.com','yes'),
('mailserver_pass','password','yes'),
('mailserver_port','110','yes'),
('default_category','1','yes'),
('default_comment_status','open','yes'),
('default_ping_status','open','yes'),
('default_pingback_flag','1','yes'),
('posts_per_page','10','yes'),
('date_format','F j, Y','yes'),
('time_format','g:i a','yes'),
('links_updated_date_format','F j, Y g:i a','yes'),
('links_recently_updated_prepend','<em>','yes'),
('links_recently_updated_append','</em>','yes'),
('links_recently_updated_time','120','yes'),
('comment_moderation','0','yes'),
('moderation_notify','1','yes'),
('permalink_structure','','yes'),
('gzipcompression','0','yes'),
('hack_file','0','yes'),
('blog_charset','UTF-8','yes'),
('moderation_keys','','no'),
('active_plugins','a:1:{i:0;s:40:\"option-url-changes/option-url-change.php\";}','yes'),
('home','http://localhost/TantraProjects/Ranjit/nt_plugin','yes'),
('category_base','','yes'),('ping_sites','http://rpc.pingomatic.com/','yes'),
('advanced_edit','0','yes'),('comment_max_links','2','yes'),('gmt_offset','0','yes'),
('default_email_category','1','yes'),('recently_edited','','no'),
('template','twentyeleven','yes'),('stylesheet','twentyeleven','yes'),
('comment_whitelist','1','yes'),('blacklist_keys','','no'),
('comment_registration','0','yes'),('html_type','text/html','yes'),
('use_trackback','0','yes'),('default_role','subscriber','yes'),
('db_version','22441','yes'),('uploads_use_yearmonth_folders','1','yes'),
('upload_path','','yes'),('blog_public','1','yes'),('default_link_category','2','yes'),
('show_on_front','posts','yes'),('tag_base','','yes'),('show_avatars','1','yes'),
('avatar_rating','G','yes'),('upload_url_path','','yes'),
('thumbnail_size_w','150','yes'),
('thumbnail_size_h','150','yes'),('thumbnail_crop','1','yes'),
('medium_size_w','300','yes'),('medium_size_h','300','yes'),
('avatar_default','mystery','yes'),('large_size_w','1024','yes'),
('large_size_h','1024','yes'),('image_default_link_type','file','yes'),
('image_default_size','','yes'),('image_default_align','','yes'),
('close_comments_for_old_posts','0','yes'),('close_comments_days_old','14','yes'),
('thread_comments','1','yes'),('thread_comments_depth','5','yes'),
('page_comments','0','yes'),('comments_per_page','50','yes'),
('default_comments_page','newest','yes'),('comment_order','asc','yes'),
('sticky_posts','a:0:{}','yes'),
('widget_categories','a:2:{i:2;a:4:{s:5:\"title\";s:0:\"\";s:5:\"count\";i:0;s:12:\"hierarchical\";i:0;s:8:\"dropdown\";i:0;}s:12:\"_multiwidget\";i:1;}','yes'),
('widget_text','a:0:{}','yes'),
('widget_rss','a:0:{}','yes'),
('uninstall_plugins','a:0:{}','no'),
('timezone_string','','yes'),
('page_for_posts','0','yes')

当我导入此文件时,它会显示如下所示的错误消息。

#1064 - 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

INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`)
VALUES('siteurl','http://localhost/TantraProjects/Ranjit/nt_plugin','yes'),
('blogname','NT PLUGIN','yes'),
('blogdescription','Just another WordPress site','yes'),
('users_can_register','0','yes'),
('admin_email','ranjit.pradhan@nettantra.com','yes'),
('start_of_week','1','yes'),
('use_balanceTags','0','yes'),
('use_smilies','1','yes'),
('require_name_email','1','yes'),
('comments_notify','1','yes'),
('posts_per_rss','10','yes'),
('rss_use_excerpt','0','yes'),
('mailserver_url','mail.example.com','yes'),
('mailserver_login','login@example.com','yes'),
('mailserver_pass','password','yes'),
('mailserver_port','110','yes'),
('default_category','1','yes'),
('default_comment_status','open','yes'),
('default_ping_status','open','yes'),
('default_pingback_flag','1','yes'),
('posts_per_page','10','yes'),
('date_format','F j, Y','yes'),
('time_format','g:i a','yes'),
('links_updated_date_format','F j, Y g:i a','yes'),
('links_recently_updated_prepen[...]

我在这里做错了什么,请帮助我

4

2 回答 2

0

您的查询工作正常。您的查询没有问题。

我用这个结构创建了一个测试表

如果不存在则创建表wp_optionsoption_namevarchar(250) NOT NULL, option_valuevarchar(250) NOT NULL, autoloadvarchar(250) NOT NULL, idint(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY ( id) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=88 ;

并尝试添加运行您的插入查询

于 2013-02-21T11:23:50.083 回答
0

你是如何导入文件的?

您还没有指定要导入哪个数据库

USE Databasename;

INSERT INTO ...
于 2013-02-21T10:51:45.487 回答