どうもoptionのテーブルを移行すると問題が発生するよう。UTF-8にしたいので、DBは移行したいのですが、どうするのが一番いいのかなぁ。下記は既存のものをいったんwordpress2へいれてから、SQL文で転送しています。古いWordPressのDBだと謎のフィールドが増えていたりして、一致していなかったため、このようにしています。
create database wordpress character set utf8;
grant all on wordpress.* to wordpress@localhost identified by 'xxxxxxxx';
delete from wordpress.wp_hiro345_linkcategories;
insert into wordpress.wp_hiro345_linkcategories (
cat_id,
cat_name,
auto_toggle,
show_images,
show_description,
show_rating,
show_updated,
sort_order,
sort_desc,
text_before_link,
text_after_link,
text_after_all,
list_limit
) select
cat_id,
cat_name,
auto_toggle,
show_images,
show_description,
show_rating,
show_updated,
sort_order,
sort_desc,
text_before_link,
text_after_link,
text_after_all,
list_limit
from wordpress2.wp_hiro345_linkcategories;
delete from wordpress.wp_hiro345_links;
insert into wordpress.wp_hiro345_links (
link_id,
link_url,
link_name,
link_image,
link_target,
link_category,
link_description,
link_visible,
link_owner,
link_rating,
link_updated,
link_rel,
link_notes,
link_rss
) select
link_id,
link_url,
link_name,
link_image,
link_target,
link_category,
link_description,
link_visible,
link_owner,
link_rating,
link_updated,
link_rel,
link_notes,
link_rss
from wordpress2.wp_hiro345_links;
delete from wordpress.wp_hiro345_post2cat;
insert into wordpress.wp_hiro345_post2cat (
rel_id,
post_id,
category_id
) select
rel_id,
post_id,
category_id
from wordpress2.wp_hiro345_post2cat;
delete from wordpress.wp_hiro345_postmeta;
insert into wordpress.wp_hiro345_postmeta (
meta_id,
post_id,
meta_key,
meta_value
) select
meta_id,
post_id,
meta_key,
meta_value
from wordpress2.wp_hiro345_postmeta;
delete from wordpress.wp_hiro345_posts;
insert into wordpress.wp_hiro345_posts (
ID,
post_author,
post_date,
post_date_gmt,
post_content,
post_title,
post_category,
post_excerpt,
post_status,
comment_status,
ping_status,
post_password,
post_name,
to_ping,
pinged,
post_modified,
post_modified_gmt,
post_content_filtered,
post_parent,
guid,
menu_order,
post_type,
post_mime_type,
comment_count
) select
ID,
post_author,
post_date,
post_date_gmt,
post_content,
post_title,
post_category,
post_excerpt,
post_status,
comment_status,
ping_status,
post_password,
post_name,
to_ping,
pinged,
post_modified,
post_modified_gmt,
post_content_filtered,
post_parent,
guid,
menu_order,
post_type,
post_mime_type,
comment_count
from wordpress2.wp_hiro345_posts;
delete from wordpress.wp_hiro345_categories;
insert into wordpress.wp_hiro345_categories(
cat_ID,
cat_name,
category_nicename,
category_description,
category_parent,
category_count
) select
cat_ID,
cat_name,
category_nicename,
category_description,
category_parent,
category_count
from wordpress2.wp_hiro345_categories;
delete from wordpress.wp_hiro345_comments;
insert into wordpress.wp_hiro345_comments(
comment_ID,
comment_post_ID,
comment_author,
comment_author_email,
comment_author_url,
comment_author_IP,
comment_date,
comment_date_gmt,
comment_content,
comment_karma,
comment_approved,
comment_agent,
comment_type,
comment_parent,
user_id
) select
comment_ID,
comment_post_ID,
comment_author,
comment_author_email,
comment_author_url,
comment_author_IP,
comment_date,
comment_date_gmt,
comment_content,
comment_karma,
comment_approved,
comment_agent,
comment_type,
comment_parent,
user_id
from wordpress2.wp_hiro345_comments;
delete from wordpress.wp_hiro345_usermeta;
insert into wordpress.wp_hiro345_usermeta (
umeta_id,
user_id,
meta_key,
meta_value
) select
umeta_id,
user_id,
meta_key,
meta_value
from wordpress2.wp_hiro345_usermeta;
delete from wordpress.wp_hiro345_users;
insert into wordpress.wp_hiro345_users (
ID,
user_login,
user_pass,
user_nicename,
user_email,
user_url,
user_registered,
user_activation_key,
user_status,
display_name
) select
ID,
user_login,
user_pass,
user_nicename,
user_email,
user_url,
user_registered,
user_activation_key,
user_status,
display_name
from wordpress2.wp_hiro345_users;
delete from wordpress.wp_hiro345_options;
insert into wordpress.wp_hiro345_options (
option_id,
blog_id,
option_name,
option_can_override,
option_type,
option_value,
option_width,
option_height,
option_description,
option_admin_level,
autoload
) select
option_id,
blog_id,
option_name,
option_can_override,
option_type,
option_value,
option_width,
option_height,
option_description,
option_admin_level,
autoload
from wordpress2.wp_hiro345_options;