Search
Close this search box.
Search
Close this search box.

Converting your database to UTF8

The following works with WordPress 3.5.2.

wp_terms

# wp_terms name
alter table wp_terms change name name VARCHAR(200) character set latin1;
alter table wp_terms change name name VARBINARY(200);
alter table wp_terms change name name VARCHAR(200) character set utf8;
# wp_terms slug
alter table wp_terms change slug slug VARCHAR(200) character set latin1;
alter table wp_terms change slug slug VARBINARY(200);
alter table wp_terms change slug slug VARCHAR(200) character set utf8;

ALTER TABLE wp_terms CHARACTER SET utf8;

wp_posts

# post_content			
alter table wp_posts change post_content post_content LONGTEXT CHARACTER SET latin1;
alter table wp_posts change post_content post_content LONGBLOB;
alter table wp_posts change post_content post_content LONGTEXT CHARACTER SET utf8;
# post_title
alter table wp_posts change post_title post_title TEXT CHARACTER SET latin1;
alter table wp_posts change post_title post_title BLOB;
alter table wp_posts change post_title post_title TEXT CHARACTER SET utf8;
# post_excerpt
alter table wp_posts change post_excerpt post_excerpt TEXT CHARACTER SET latin1;
alter table wp_posts change post_excerpt post_excerpt BLOB;
alter table wp_posts change post_excerpt post_excerpt TEXT CHARACTER SET utf8;	
# post_status
alter table wp_posts change post_status post_status VARCHAR(20) character set latin1;
alter table wp_posts change post_status post_status VARBINARY(20);
alter table wp_posts change post_status post_status VARCHAR(20) character set utf8;
# wp_posts comment_status
alter table wp_posts change comment_status comment_status VARCHAR(20) character set latin1;
alter table wp_posts change comment_status comment_status VARBINARY(20);
alter table wp_posts change comment_status comment_status VARCHAR(20) character set utf8;
# ping_status
alter table wp_posts change ping_status ping_status VARCHAR(20) character set latin1;
alter table wp_posts change ping_status ping_status VARBINARY(20);
alter table wp_posts change ping_status ping_status VARCHAR(20) character set utf8;
# post_password
alter table wp_posts change post_password post_password VARCHAR(20) character set latin1;
alter table wp_posts change post_password post_password VARBINARY(20);
alter table wp_posts change post_password post_password VARCHAR(20) character set utf8;
# post_name
alter table wp_posts change post_name post_name VARCHAR(200) character set latin1;
alter table wp_posts change post_name post_name VARBINARY(200);
alter table wp_posts change post_name post_name VARCHAR(200) character set utf8;
# wp_posts to_ping
alter table wp_posts change to_ping to_ping TEXT CHARACTER SET latin1;
alter table wp_posts change to_ping to_ping BLOB;
alter table wp_posts change to_ping to_ping TEXT CHARACTER SET utf8;
# wp_posts pinged
alter table wp_posts change pinged pinged TEXT CHARACTER SET latin1;
alter table wp_posts change pinged pinged BLOB;
alter table wp_posts change pinged pinged TEXT CHARACTER SET utf8;
# post_content_filtered
alter table wp_posts change post_content_filtered post_content_filtered TEXT CHARACTER SET latin1;
alter table wp_posts change post_content_filtered post_content_filtered BLOB;
alter table wp_posts change post_content_filtered post_content_filtered TEXT CHARACTER SET utf8;
# guid
alter table wp_posts change guid guid VARCHAR(255) character set latin1;
alter table wp_posts change guid guid VARBINARY(255);
alter table wp_posts change guid guid VARCHAR(255) character set utf8;
# post_type
alter table wp_posts change post_type post_type VARCHAR(20) character set latin1;
alter table wp_posts change post_type post_type VARBINARY(20);
alter table wp_posts change post_type post_type VARCHAR(20) character set utf8;
# post_mime_type
alter table wp_posts change post_mime_type post_mime_type VARCHAR(100) character set latin1;
alter table wp_posts change post_mime_type post_mime_type VARBINARY(100);
alter table wp_posts change post_mime_type post_mime_type VARCHAR(100) character set utf8;

ALTER TABLE wp_posts CHARACTER SET utf8;

wp_postmeta

# wp_postmeta meta_key
alter table wp_postmeta change meta_key meta_key VARCHAR(255) character set latin1;
alter table wp_postmeta change meta_key meta_key VARBINARY(255);
alter table wp_postmeta change meta_key meta_key VARCHAR(255) character set utf8;
# wp_postmeta meta_value
alter table wp_postmeta change meta_value meta_value LONGTEXT character set latin1;
alter table wp_postmeta change meta_value meta_value LONGBLOB;
alter table wp_postmeta change meta_value meta_value LONGTEXT character set utf8;

ALTER TABLE wp_postmeta CHARACTER SET utf8;

Learning Resources

User:JeremyClarke/exampleSQLForUTF8Conversion article.