Skip to content

Instantly share code, notes, and snippets.

@summersab
Created June 29, 2022 18:48
Show Gist options
  • Save summersab/ec053cdbea162bca3aa4ecb72b039aba to your computer and use it in GitHub Desktop.
Save summersab/ec053cdbea162bca3aa4ecb72b039aba to your computer and use it in GitHub Desktop.
Convert SQLite WordPress DB to MySQL
USE wordpress;
CREATE TABLE IF NOT EXISTS `wp_commentmeta` (
`meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`comment_id` bigint(20) unsigned NOT NULL DEFAULT 0,
`meta_key` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`meta_value` longtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
PRIMARY KEY (`meta_id`),
KEY `comment_id` (`comment_id`),
KEY `meta_key` (`meta_key`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_links` (
`link_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`link_url` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`link_name` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`link_image` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`link_target` varchar(25) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`link_description` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`link_visible` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'Y',
`link_owner` bigint(20) unsigned NOT NULL DEFAULT 1,
`link_rating` int(11) NOT NULL DEFAULT 0,
`link_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`link_rel` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`link_notes` mediumtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
`link_rss` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
PRIMARY KEY (`link_id`),
KEY `link_visible` (`link_visible`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_snippets` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` tinytext COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`description` text COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`code` longtext COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`tags` longtext COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`scope` varchar(15) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'global',
`priority` smallint(6) NOT NULL DEFAULT 10,
`active` tinyint(1) NOT NULL DEFAULT 0,
`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `scope` (`scope`),
KEY `active` (`active`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_term_taxonomy` (
`term_taxonomy_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`term_id` bigint(20) unsigned NOT NULL DEFAULT 0,
`taxonomy` varchar(32) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`description` longtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
`parent` bigint(20) unsigned NOT NULL DEFAULT 0,
`count` bigint(20) NOT NULL DEFAULT 0,
PRIMARY KEY (`term_taxonomy_id`),
UNIQUE KEY `term_id_taxonomy` (`term_id`,`taxonomy`),
KEY `taxonomy` (`taxonomy`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_usermeta` (
`umeta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL DEFAULT 0,
`meta_key` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`meta_value` longtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
PRIMARY KEY (`umeta_id`),
KEY `user_id` (`user_id`),
KEY `meta_key` (`meta_key`(191))
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_comments` (
`comment_ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`comment_post_ID` bigint(20) unsigned NOT NULL DEFAULT 0,
`comment_author` tinytext COLLATE utf8mb4_unicode_520_ci NOT NULL,
`comment_author_email` varchar(100) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`comment_author_url` varchar(200) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`comment_author_IP` varchar(100) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`comment_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`comment_date_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`comment_content` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
`comment_karma` int(11) NOT NULL DEFAULT 0,
`comment_approved` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '1',
`comment_agent` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`comment_type` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'comment',
`comment_parent` bigint(20) unsigned NOT NULL DEFAULT 0,
`user_id` bigint(20) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`comment_ID`),
KEY `comment_post_ID` (`comment_post_ID`),
KEY `comment_approved_date_gmt` (`comment_approved`,`comment_date_gmt`),
KEY `comment_date_gmt` (`comment_date_gmt`),
KEY `comment_parent` (`comment_parent`),
KEY `comment_author_email` (`comment_author_email`(10))
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_e_events` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`event_data` text COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `created_at_index` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_users` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_login` varchar(60) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`user_pass` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`user_nicename` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`user_email` varchar(100) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`user_url` varchar(100) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`user_registered` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`user_activation_key` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`user_status` int(11) NOT NULL DEFAULT 0,
`display_name` varchar(250) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
PRIMARY KEY (`ID`),
KEY `user_login_key` (`user_login`),
KEY `user_nicename` (`user_nicename`),
KEY `user_email` (`user_email`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_termmeta` (
`meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`term_id` bigint(20) unsigned NOT NULL DEFAULT 0,
`meta_key` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`meta_value` longtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
PRIMARY KEY (`meta_id`),
KEY `term_id` (`term_id`),
KEY `meta_key` (`meta_key`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_e_submissions_values` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`submission_id` bigint(20) unsigned NOT NULL DEFAULT 0,
`key` varchar(60) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`value` longtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `submission_id_index` (`submission_id`),
KEY `key_index` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_postmeta` (
`meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`post_id` bigint(20) unsigned NOT NULL DEFAULT 0,
`meta_key` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`meta_value` longtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
PRIMARY KEY (`meta_id`),
KEY `post_id` (`post_id`),
KEY `meta_key` (`meta_key`(191))
) ENGINE=InnoDB AUTO_INCREMENT=497 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_e_submissions_actions_log` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`submission_id` bigint(20) unsigned NOT NULL,
`action_name` varchar(60) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`action_label` varchar(60) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`status` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`log` text COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`created_at_gmt` datetime NOT NULL,
`updated_at_gmt` datetime NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `submission_id_index` (`submission_id`),
KEY `action_name_index` (`action_name`),
KEY `status_index` (`status`),
KEY `created_at_gmt_index` (`created_at_gmt`),
KEY `updated_at_gmt_index` (`updated_at_gmt`),
KEY `created_at_index` (`created_at`),
KEY `updated_at_index` (`updated_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_posts` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`post_author` bigint(20) unsigned NOT NULL DEFAULT 0,
`post_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`post_date_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`post_content` longtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
`post_title` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
`post_excerpt` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
`post_status` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'publish',
`comment_status` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'open',
`ping_status` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'open',
`post_password` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`post_name` varchar(200) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`to_ping` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
`pinged` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
`post_modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`post_modified_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`post_content_filtered` longtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
`post_parent` bigint(20) unsigned NOT NULL DEFAULT 0,
`guid` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`menu_order` int(11) NOT NULL DEFAULT 0,
`post_type` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'post',
`post_mime_type` varchar(100) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`comment_count` bigint(20) NOT NULL DEFAULT 0,
PRIMARY KEY (`ID`),
KEY `post_name` (`post_name`(191)),
KEY `type_status_date` (`post_type`,`post_status`,`post_date`,`ID`),
KEY `post_parent` (`post_parent`),
KEY `post_author` (`post_author`)
) ENGINE=InnoDB AUTO_INCREMENT=83 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_term_relationships` (
`object_id` bigint(20) unsigned NOT NULL DEFAULT 0,
`term_taxonomy_id` bigint(20) unsigned NOT NULL DEFAULT 0,
`term_order` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`object_id`,`term_taxonomy_id`),
KEY `term_taxonomy_id` (`term_taxonomy_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_terms` (
`term_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(200) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`slug` varchar(200) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`term_group` bigint(10) NOT NULL DEFAULT 0,
PRIMARY KEY (`term_id`),
KEY `slug` (`slug`(191)),
KEY `name` (`name`(191))
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_e_submissions` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`type` varchar(60) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`hash_id` varchar(60) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`main_meta_id` bigint(20) unsigned NOT NULL COMMENT 'Id of main field. to represent the main meta field',
`post_id` bigint(20) unsigned NOT NULL,
`referer` varchar(500) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`referer_title` varchar(300) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`element_id` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`form_name` varchar(60) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`campaign_id` bigint(20) unsigned NOT NULL,
`user_id` bigint(20) unsigned DEFAULT NULL,
`user_ip` varchar(46) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`user_agent` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
`actions_count` int(11) DEFAULT 0,
`actions_succeeded_count` int(11) DEFAULT 0,
`status` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`is_read` tinyint(1) NOT NULL DEFAULT 0,
`meta` text COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`created_at_gmt` datetime NOT NULL,
`updated_at_gmt` datetime NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `hash_id_unique_index` (`hash_id`),
KEY `main_meta_id_index` (`main_meta_id`),
KEY `hash_id_index` (`hash_id`),
KEY `type_index` (`type`),
KEY `post_id_index` (`post_id`),
KEY `element_id_index` (`element_id`),
KEY `campaign_id_index` (`campaign_id`),
KEY `user_id_index` (`user_id`),
KEY `user_ip_index` (`user_ip`),
KEY `status_index` (`status`),
KEY `is_read_index` (`is_read`),
KEY `created_at_gmt_index` (`created_at_gmt`),
KEY `updated_at_gmt_index` (`updated_at_gmt`),
KEY `created_at_index` (`created_at`),
KEY `updated_at_index` (`updated_at`),
KEY `referer_index` (`referer`(191)),
KEY `referer_title_index` (`referer_title`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
CREATE TABLE IF NOT EXISTS `wp_options` (
`option_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`option_name` varchar(191) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`option_value` longtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
`autoload` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'yes',
PRIMARY KEY (`option_id`),
UNIQUE KEY `option_name` (`option_name`),
KEY `autoload` (`autoload`)
) ENGINE=InnoDB AUTO_INCREMENT=375 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ;
ALTER TABLE `wp_commentmeta`
MODIFY `meta_id` bigint(20),
MODIFY `comment_id` bigint(20),
MODIFY `meta_key` varchar(255),
MODIFY `meta_value` longtext;
ALTER TABLE `wp_links`
MODIFY `link_id` bigint(20),
MODIFY `link_url` varchar(255),
MODIFY `link_name` varchar(255),
MODIFY `link_image` varchar(255),
MODIFY `link_target` varchar(25),
MODIFY `link_description` varchar(255),
MODIFY `link_visible` varchar(20),
MODIFY `link_owner` bigint(20),
MODIFY `link_rating` int(11),
MODIFY `link_updated` datetime,
MODIFY `link_rel` varchar(255),
MODIFY `link_notes` mediumtext,
MODIFY `link_rss` varchar(255);
ALTER TABLE `wp_snippets`
MODIFY `id` bigint(20),
MODIFY `name` tinytext,
MODIFY `description` text,
MODIFY `code` longtext,
MODIFY `tags` longtext,
MODIFY `scope` varchar(15),
MODIFY `priority` smallint(6),
MODIFY `active` tinyint(1),
MODIFY `modified` datetime;
ALTER TABLE `wp_term_taxonomy`
MODIFY `term_taxonomy_id` bigint(20),
MODIFY `term_id` bigint(20),
MODIFY `taxonomy` varchar(32),
MODIFY `description` longtext,
MODIFY `parent` bigint(20),
MODIFY `count` bigint(20);
ALTER TABLE `wp_usermeta`
MODIFY `umeta_id` bigint(20),
MODIFY `user_id` bigint(20),
MODIFY `meta_key` varchar(255),
MODIFY `meta_value` longtext;
ALTER TABLE `wp_comments`
MODIFY `comment_ID` bigint(20),
MODIFY `comment_post_ID` bigint(20),
MODIFY `comment_author` tinytext,
MODIFY `comment_author_email` varchar(100),
MODIFY `comment_author_url` varchar(200),
MODIFY `comment_author_IP` varchar(100),
MODIFY `comment_date` datetime,
MODIFY `comment_date_gmt` datetime,
MODIFY `comment_content` text,
MODIFY `comment_karma` int(11),
MODIFY `comment_approved` varchar(20),
MODIFY `comment_agent` varchar(255),
MODIFY `comment_type` varchar(20),
MODIFY `comment_parent` bigint(20),
MODIFY `user_id` bigint(20);
ALTER TABLE `wp_e_events`
MODIFY `id` bigint(20),
MODIFY `event_data` text,
MODIFY `created_at` datetime;
ALTER TABLE `wp_users`
MODIFY `ID` bigint(20),
MODIFY `user_login` varchar(60),
MODIFY `user_pass` varchar(255),
MODIFY `user_nicename` varchar(50),
MODIFY `user_email` varchar(100),
MODIFY `user_url` varchar(100),
MODIFY `user_registered` datetime,
MODIFY `user_activation_key` varchar(255),
MODIFY `user_status` int(11),
MODIFY `display_name` varchar(250);
ALTER TABLE `wp_termmeta`
MODIFY `meta_id` bigint(20),
MODIFY `term_id` bigint(20),
MODIFY `meta_key` varchar(255),
MODIFY `meta_value` longtext;
ALTER TABLE `wp_e_submissions_values`
MODIFY `id` bigint(20),
MODIFY `submission_id` bigint(20),
MODIFY `key` varchar(60),
MODIFY `value` longtext;
ALTER TABLE `wp_postmeta`
MODIFY `meta_id` bigint(20),
MODIFY `post_id` bigint(20),
MODIFY `meta_key` varchar(255),
MODIFY `meta_value` longtext;
ALTER TABLE `wp_e_submissions_actions_log`
MODIFY `id` bigint(20),
MODIFY `submission_id` bigint(20),
MODIFY `action_name` varchar(60),
MODIFY `action_label` varchar(60),
MODIFY `status` varchar(20),
MODIFY `log` text,
MODIFY `created_at_gmt` datetime,
MODIFY `updated_at_gmt` datetime,
MODIFY `created_at` datetime,
MODIFY `updated_at` datetime;
ALTER TABLE `wp_posts`
MODIFY `ID` bigint(20),
MODIFY `post_author` bigint(20),
MODIFY `post_date` datetime,
MODIFY `post_date_gmt` datetime,
MODIFY `post_content` longtext,
MODIFY `post_title` text,
MODIFY `post_excerpt` text,
MODIFY `post_status` varchar(20),
MODIFY `comment_status` varchar(20),
MODIFY `ping_status` varchar(20),
MODIFY `post_password` varchar(255),
MODIFY `post_name` varchar(200),
MODIFY `to_ping` text,
MODIFY `pinged` text,
MODIFY `post_modified` datetime,
MODIFY `post_modified_gmt` datetime,
MODIFY `post_content_filtered` longtext,
MODIFY `post_parent` bigint(20),
MODIFY `guid` varchar(255),
MODIFY `menu_order` int(11),
MODIFY `post_type` varchar(20),
MODIFY `post_mime_type` varchar(100),
MODIFY `comment_count` bigint(20);
ALTER TABLE `wp_term_relationships`
MODIFY `object_id` bigint(20),
MODIFY `term_taxonomy_id` bigint(20),
MODIFY `term_order` int(11);
ALTER TABLE `wp_terms`
MODIFY `term_id` bigint(20),
MODIFY `name` varchar(200),
MODIFY `slug` varchar(200),
MODIFY `term_group` bigint(10);
ALTER TABLE `wp_e_submissions`
MODIFY `id` bigint(20),
MODIFY `type` varchar(60),
MODIFY `hash_id` varchar(60),
MODIFY `main_meta_id` bigint(20),
MODIFY `post_id` bigint(20),
MODIFY `referer` varchar(500),
MODIFY `referer_title` varchar(300),
MODIFY `element_id` varchar(20),
MODIFY `form_name` varchar(60),
MODIFY `campaign_id` bigint(20),
MODIFY `user_id` bigint(20),
MODIFY `user_ip` varchar(46),
MODIFY `user_agent` text,
MODIFY `actions_count` int(11),
MODIFY `actions_succeeded_count` int(11),
MODIFY `status` varchar(20),
MODIFY `is_read` tinyint(1),
MODIFY `meta` text,
MODIFY `created_at_gmt` datetime,
MODIFY `updated_at_gmt` datetime,
MODIFY `created_at` datetime,
MODIFY `updated_at` datetime;
ALTER TABLE `wp_options`
MODIFY `option_id` bigint(20),
MODIFY `option_name` varchar(191),
MODIFY `option_value` longtext,
MODIFY `autoload` varchar(20);
#!/bin/bash
# This converts a SQLite Wordpress DB to MySQL using the `sqlite3mysql` tool and
# by updating the column types. NOTE: This does not fix tables used by plugins -
# it only fixes core WP tables. In order to convert plugin tables, you need to:
# - Install WP with a MySQL DB
# - Install the desired plugin
# - Determine the plugin's table schema by using `SHOW CREATE TABLE [table_name]`
# - Modify the alter-tables.sql file below accordingly
# Install sqlite3mysql
pip install sqlite3-to-mysql
# Get the database and user ready. Change the password for production
sudo mysql -e "DROP DATABASE IF EXISTS wordpress";
sudo mysql -e "CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress';"
sudo mysql -e "GRANT ALL ON wordpress.* to 'wordpress'@'localhost' IDENTIFIED BY 'wordpress';"
# Import the the SQLite database to MySQL
sqlite3mysql -f db -d wordpress -u wordpress -p
# Update the column types
sudo mysql < create_db.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment