<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Complex CMS Migration Service - Migrate Content (Posts about database)</title><link>https://migratecontent.com/</link><description></description><atom:link href="https://migratecontent.com/categories/database.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><lastBuildDate>Mon, 23 Mar 2026 12:51:16 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>How to set up a MySQL database server on Ubuntu for Drupal to WordPress migrations</title><link>https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/</link><dc:creator>Anthony Lopez-Vito</dc:creator><description>&lt;p&gt;Content Management System (CMS) migration projects involve moving data between databases with different schemas. Table names, field types and constraints often don't match up, leading to a number of frustrating errors. This is especially the case with &lt;a href="https://migratecontent.com/content-migration-process/"&gt;highly complex Drupal to WordPress migrations&lt;/a&gt; that use custom scripts to extract, transform and load the data. These projects can seem like you're constantly hitting roadblocks throughout. I've found from experience that running the migration in an appropriate development environment can reduce a great deal of effort. In this guide, I will describe how to set up a MySQL database server on Ubuntu for Drupal to WordPress migrations.&lt;/p&gt;

&lt;figure class="figure d-flex flex-column align-items-center"&gt;
    &lt;img src="https://migratecontent.com/images/rubaitul-azad-Y9kOsyoWyaU-unsplash.jpg" alt="MySQL database logo" class="figure-img img-fluid rounded" width="800" height="500"&gt;
&lt;/figure&gt;

&lt;h2 id="drupal-to-wordPress-mysql-server-toc"&gt;Table of contents&lt;/h2&gt;
&lt;div class="toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#why-mysql-ubuntu"&gt;Why MySQL and Ubuntu?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#installing-mysql-for-migrations"&gt;Installing MySQL on Ubuntu for CMS migrations&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#setup-lamp-migration-platform"&gt;Set up your Ubuntu LAMP migration platform&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#install-mysql"&gt;Install MySQL&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#setting-sql-mode"&gt;Setting the MySQL server SQL mode&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#set-global-sql-mode"&gt;Option 1: Setting the global sql_mode in the database&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#set-mysql-config-file"&gt;Option 2: setting the sql_mode in the MySQL configuration file&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#locating-mysql-conf"&gt;Locating the MySQL configuration file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#edit-mysql-config-file"&gt;Editing the MySQL configuration file&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#potential-errors"&gt;Potential errors&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#mysqldump-access-denied-when-trying-to-dump-tablespaces"&gt;mysqldump access denied when trying to dump tablespaces&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#ERROR-1067-42000-Invalid-default-value"&gt;ERROR 1067 (42000) Invalid default value&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#Expression-1-of-SELECT-list-is-not-in-GROUP-BY-clause"&gt;Expression #1 of SELECT list is not in GROUP BY clause&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#Error-Code-2013-Lost-connection-to-MySQL-server"&gt;Error Code: 2013. Lost connection to MySQL server&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#conclusion"&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;

&lt;h2 id="why-mysql-ubuntu"&gt;Why MySQL and Ubuntu?&lt;/h2&gt;
&lt;p&gt;The first thing to address is &lt;em&gt;why MySQL and Ubuntu?&lt;/em&gt; How about MariaDB? How about Arch Linux, Mac OS or Windows? Yes! Any platform that runs Drupal and WordPress will work for your migration environment so you can use whatever you prefer. Personally, I have a fondness for &lt;a href="https://www.openbsd.org/" target="_blank" rel="noreferrer noopener"&gt;OpenBSD&lt;/a&gt; but it's not a practical platform for a CMS migration. OpenBSD's niche user-base means you'll spend much longer installing necessary tools and troubleshooting errors.&lt;/p&gt;
&lt;p&gt;There are all sorts of tutorials covering MySQL on Ubuntu. This means you're more likely to quickly find a solution from a web search when you hit a problem. Furthermore, if you need a software utility or program to help you get the job done, it will probably be available through &lt;code&gt;apt&lt;/code&gt;, &lt;code&gt;dpkg&lt;/code&gt;,  &lt;code&gt;snap&lt;/code&gt; or &lt;code&gt;tasksel&lt;/code&gt;. Use whatever you like but for now, MySQL on Ubuntu is my recommended platform for Drupal to WordPress migrations. I expect this will be the case for some time to come. These projects are complex and time-consuming enough without making the &lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#mariadb-mysql-purge"&gt;job more difficult&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id="installing-mysql-for-migrations"&gt;Installing MySQL on Ubuntu for CMS migrations&lt;/h2&gt;
&lt;p&gt;There are many detailed tutorials for installing MySQL on Ubuntu. DigitalOcean's &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04" target="_blank" rel="noreferrer noopener nofollow"&gt;How To Install MySQL on Ubuntu 20.04&lt;/a&gt; is a good one and writing another won't add much value. My guide will therefore only give a brief overview of the MySQL server installation steps. Instead, I will focus on the configuration areas specifically related avoiding problems on a CMS migration project.&lt;/p&gt;
&lt;p&gt;You may wonder why the migration environment should be much different from a live server. Migration projects require you to do things that aren't supported by the CMS platform. You're therefore likely to encounter &lt;a href="https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/#potential-errors"&gt;weird errors&lt;/a&gt; that aren't normally found when running standard Drupal or WordPress.&lt;/p&gt;

&lt;h3 id="setup-lamp-migration-platform"&gt;Set up your Ubuntu LAMP migration platform&lt;/h3&gt;
&lt;p&gt;The main source of unusual errors is almost certainly because you're migrating on a setup suited to a live website. Live server configurations are more restrictive than you need for a migration project. You can therefore save yourself a huge headache by rolling your own local migration environment. It might take a little longer to get started but you'll save time by avoiding lots of unnecessary troubleshooting.&lt;/p&gt;
&lt;p&gt;I must highlight that this will be a &lt;em&gt;local migration environment&lt;/em&gt; and should not be accessible from the public internet. The normal security considerations with running a live content management system don't apply when you're working locally. By all means follow basic security measures mentioned the various tutorials for setting up Ubuntu and MySQL. Nevertheless, a highly secure setup is counterproductive for these projects and you can avoid trouble by being a little more permissive.&lt;/p&gt;
&lt;p&gt;Go ahead and &lt;a href="https://ubuntu.com/tutorials/install-ubuntu-desktop" target="_blank" rel="noreferrer noopener"&gt;install Ubuntu Desktop&lt;/a&gt;. Since this will be a development environment, you'll want the Desktop environment rather than the more lightweight server version. Of course, you'll still need to install a web and database server. &lt;a href="https://upcloud.com/community/tutorials/installing-lamp-stack-ubuntu/" target="_blank" rel="noreferrer noopener"&gt;Follow these instructions for installing LAMP stack&lt;/a&gt; but skip the step of installing MariaDB. As mentioned above, we'll be using MySQL.&lt;/p&gt;


&lt;div id="mariadb-mysql-purge" class="alert alert-warning"&gt;
&lt;p class="has-text-align-left"&gt;&lt;strong&gt;WARNING:&lt;/strong&gt; Installing MariaDB over MySQL or vice versa on Ubuntu 20.04 may lead to all sorts of &lt;a href="https://askubuntu.com/questions/1300304/mysql-not-working-after-uninstall-mariadb-in-ubuntu" target="_blank" rel="noreferrer noopener"&gt;problems starting up the database server&lt;/a&gt; with errors like the following:&lt;/p&gt;
&lt;p class="has-text-align-left"&gt;&lt;code&gt;Failed to start mysqld.service: Unit mysqld.service not found&lt;/code&gt;.&lt;/p&gt;
&lt;p class="has-text-align-left"&gt;The last time I did this, none of solutions mentioned online for purging the installation worked. I spent most of a day trying to fix the problem. In the end, I realised it was quicker to start again and rebuild the machine from scratch. This is a big reason why I decided to stick with MySQL as standard for my projects.&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id="install-mysql"&gt;Install MySQL&lt;/h3&gt;
&lt;p&gt;You can read a more detailed tutorial on &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04" target="_blank" rel="noreferrer noopener"&gt;installing MySQL on Ubuntu&lt;/a&gt; but here's an overview.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Update the package index on your server: &lt;code&gt;sudo apt update&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Install MySQL server: &lt;code&gt;sudo apt install mysql-server&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Secure MySQL: &lt;code&gt;sudo /usr/bin/mysql_secure_installation&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;code&gt;mysql_secure_installation&lt;/code&gt; script doesn't cause problems for migrations so it's worth running.&lt;/p&gt;
&lt;p&gt;Create an admin user:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;CREATE USER 'user'@'localhost' IDENTIFIED BY 'userpassword';
GRANT ALL PRIVILEGES ON *.* to 'user'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
quit;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now create a user and database for your migration project:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;CREATE USER 'projectuser'@'localhost' IDENTIFIED BY 'password';

CREATE DATABASE project_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;
GRANT ALL ON project_db.* TO 'projectuser'@'localhost';&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You can give this user more restrictive permissions but &lt;code&gt;GRANT ALL&lt;/code&gt; avoids errors when running scripts and SQL queries on the database. Only the migration team should have access and you won't need it after the migration so why not make your life easier? &lt;/p&gt;

&lt;h2 id="setting-sql-mode"&gt;Setting the MySQL server SQL mode&lt;/h2&gt;
&lt;p&gt;It's possible that you won't be familiar with &lt;a href="https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html" target="_blank" rel="noreferrer noopener"&gt;SQL modes&lt;/a&gt; unless you've done some database administration work. For our purposes, SQL modes do two things:&lt;/p&gt;


&lt;ul&gt;
&lt;li&gt;change the types of queries you can run on your MySQL server;&lt;/li&gt;
&lt;li&gt;change the validation checks when altering the data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I've found that specific SQL modes need to be set for Drupal to WordPress projects. You may find that all sorts of strange errors appear if the correct modes aren't set. The following sections show you two ways to set your MySQL server's SQL mode.&lt;/p&gt;

&lt;h3 id="set-global-sql-mode"&gt;Option 1: Setting the global sql_mode in the database&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Login in to database as an admin user.&lt;/li&gt;
&lt;li&gt;View the current sql-modes using &lt;code&gt;SELECT @@GLOBAL.sql_mode;&lt;/code&gt; and make a copy if necessary.&lt;/li&gt;
&lt;li&gt;Copy the current modes (add or delete modes as needed) and paste in next step.&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;ALLOW_INVALID_DATES&lt;/code&gt; and removes both &lt;code&gt;NO_ZERO_DATE, NO_ZERO_IN_DATE&lt;/code&gt; by setting the sql-modes with&lt;br&gt;&lt;code&gt;SET GLOBAL sql_mode = 'STRICT_TRANS_TABLES,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';&lt;/code&gt; (WARNING: check the modes correspond with your setup.)&lt;/li&gt;
&lt;li&gt;Restart server:&lt;br&gt;&lt;code&gt;sudo systemctl start mysql&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id="set-mysql-config-file"&gt;Option 2: setting the sql_mode in the MySQL configuration file&lt;/h3&gt;
&lt;h4 id="locating-mysql-conf"&gt;Locating the MySQL configuration file&lt;/h4&gt;
&lt;p&gt;The &lt;code&gt;my.cnf&lt;/code&gt; configuration file isn't always found in the same place. It's specific to the Linux distribution and server configuration but can normally found in one of the following locations:&lt;/p&gt;
&lt;pre class="wp-block-preformatted"&gt;/etc/my.cnf
/etc/mysql/my.cnf
echo/my.cnf
[datadir]/my.cnf
~/.my.cnf&lt;/pre&gt;

&lt;p&gt;If you can't find your MySQL configuration file, you can try running &lt;code&gt;locate my.cnf&lt;/code&gt; or &lt;code&gt;mysqladmin --help&lt;/code&gt;. The latter will show something like the following in the output:&lt;/p&gt;

&lt;pre class="wp-block-preformatted"&gt;Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf&lt;/pre&gt;
&lt;p&gt;Also keep in mind that it's possible to use &lt;code&gt;!include&lt;/code&gt; directives to include other &lt;a href="https://dev.mysql.com/doc/refman/8.0/en/option-files.html" rel="noreferrer noopener" target="_blank"&gt;option files&lt;/a&gt; and &lt;code&gt;!includedir&lt;/code&gt; to search specific directories for option files. Under Ubuntu, there may be a file &lt;code&gt;/etc/mysql/my.cnf&lt;/code&gt; with &lt;code&gt;!includedir&lt;/code&gt; directives to search &lt;code&gt;/etc/mysql/conf.d/&lt;/code&gt; and &lt;code&gt;/etc/mysql/mysql.conf.d/&lt;/code&gt;&lt;/p&gt;


&lt;h4 id="edit-mysql-config-file"&gt;Editing the MySQL configuration file&lt;/h4&gt;
&lt;p&gt;If the MySQL server finds more than one configuration file, it will load each one in turn. The values override each other and it can be difficult to know which takes priority. Furthermore, the &lt;code&gt;--defaults-file&lt;/code&gt; parameter can also override all configurations. Keep things simple and have only one file and place it the directory that makes sense to you.&lt;/p&gt;
&lt;p&gt;Before editing the &lt;code&gt;my.cnf&lt;/code&gt;, first log in to MySQL with an administrator user and run the &lt;code&gt;SELECT @@GLOBAL.sql_mode&lt;/code&gt; query to see the values used in your setup.&lt;/p&gt;

&lt;figure class="wp-block-image size-full"&gt;&lt;img src="https://migratecontent.com/images/drupal-to-wordpress-mysql-select-global-sql_mode.jpg" alt="Setting the MySQL database server sql mode on Ubuntu for Drupal to WordPress migrations" class="wp-image-3705"&gt;&lt;br&gt;
&lt;figcaption class="wp-element-caption"&gt;&lt;em&gt;Running the &lt;code&gt;SELECT @@GLOBAL.sql_mode&lt;/code&gt; query on MySQL Workbench&lt;/em&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Next, open the configuration file, look for the section &lt;code&gt;[mysqld]&lt;/code&gt; and edit the line starting with:&lt;br&gt;&lt;code&gt;sql_mode = ...&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add the line if it's not there. Adjust the exact modes to match your project's needs so take a look at the &lt;a href="https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sql-mode-full" target="_blank" rel="noreferrer noopener"&gt;list of SQL modes&lt;/a&gt; to see which may apply. I've found the following works well:&lt;br&gt;&lt;code&gt;sql_mode = "STRICT_TRANS_TABLES,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Finally, restart the MySQL server. On Ubuntu this will probably be with&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo systemctl start mysql&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If you are logged in to the MySQL server, you may also need to disconnect your client and reconnect for the changes to take effect for your session.&lt;/p&gt;

&lt;h2 id="potential-errors"&gt;Potential errors&lt;/h2&gt;
&lt;p&gt;Here are some potential errors that you may come across during a CMS migration project. I usually find them when running a Drupal to WordPress migration on a freshly built development environment.&lt;/p&gt;
&lt;h3 id="mysqldump-access-denied-when-trying-to-dump-tablespaces"&gt;mysqldump access denied when trying to dump tablespaces&lt;/h3&gt;
&lt;p&gt;Migrations involve dumping and importing databases and this process is straightforward on a mature development environment. However you may receive an 'Access denied' error out of the blue when dumping your MySQL database:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If you see this, perhaps you were working on an environment that was a little too 'mature' (in other words, obsolete!) and you have recently upgraded your installation. The updates for MySQL 5.7.31 and MySQL 8.0.21 in July 2020 introduced an incompatible change that produces this error.&lt;/p&gt;
&lt;p&gt;The fix involves granting the PROCESS privilege to the user running mysqldump, or using the &lt;code&gt;--no-tablespaces&lt;/code&gt; flag.&lt;/p&gt;
&lt;h3 id="ERROR-1067-42000-Invalid-default-value"&gt;ERROR 1067 (42000) Invalid default value&lt;/h3&gt;
&lt;p&gt;Drupal nodes store the date as a Unix timestamp in an &lt;code&gt;int&lt;/code&gt; (e.g. &lt;code&gt;1623427200&lt;/code&gt;) field whereas WordPress stores dates as &lt;code&gt;&lt;a href="https://dev.mysql.com/doc/refman/8.0/en/datetime.html" target="_blank" rel="noreferrer noopener nofollow"&gt;datetime&lt;/a&gt;&lt;/code&gt; (e.g. &lt;code&gt;2021-06-11 16:00:00&lt;/code&gt;). There may be a conversion error in your migration script or the source date could simply be zero for some reason. Normally your MySQL server mode will be set to &lt;code&gt;NO_ZERO_DATE, NO_ZERO_IN_DATE&lt;/code&gt; so trying to insert a zero date will give you the error:&lt;/p&gt;
&lt;pre class="wp-block-preformatted"&gt;&lt;code&gt;ERROR 1067 (42000) Invalid default value&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can fix this by replacing &lt;code&gt;NO_ZERO_DATE, NO_ZERO_IN_DATE&lt;/code&gt;  with set to &lt;code&gt;ALLOW_INVALID_DATES&lt;/code&gt; in your global SQL mode.&lt;/p&gt;

&lt;h3 id="Expression-1-of-SELECT-list-is-not-in-GROUP-BY-clause"&gt;Expression #1 of SELECT list is not in GROUP BY clause&lt;/h3&gt;
&lt;p&gt;You run an SQL query and get the rather cryptic error:&lt;/p&gt;
&lt;pre class="wp-block-preformatted"&gt;Expression #1 of SELECT list is not in GROUP BY clause and contains
nonaggregated column 'database.table.pid' which is not functionally dependent
on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by&lt;/pre&gt;
&lt;p&gt;What's wrong? MySQL has a &lt;code&gt;only_full_group_by&lt;/code&gt; mode which, when enabled, strictly applies ANSI SQL rules when using &lt;code&gt;GROUP BY&lt;/code&gt;. Fix this by reworking your script or removing the &lt;code&gt;ONLY_FULL_GROUP_BY&lt;/code&gt; SQL mode.&lt;/p&gt;

&lt;h3 id="Error-Code-2013-Lost-connection-to-MySQL-server"&gt;Error Code: 2013. Lost connection to MySQL server&lt;/h3&gt;
&lt;p&gt;This often happens when an SQL query takes too long to return data. The connection between your MySQL client and database server times out so the connection gets dropped. You can try increasing the &lt;code&gt;net_read_timeout&lt;/code&gt; and &lt;code&gt;net_write_timeout&lt;/code&gt; values in your MySQL configuration, or optimising the query itself.&lt;/p&gt;

&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Setting up a MySQL database server for Drupal or WordPress is a familiar task for web developers and site administrators.  However, CMS migrations have quirks that can cause obscure and baffling errors. In this guide I've shown you some little tricks that may save time and annoyance. While there's no way to provide an exhaustive list of solutions to all the MySQL problems you'll encounter, I hope to have pointed you in the right direction.&lt;/p&gt;
&lt;p&gt;If you have a site migration project and would like to hire me, please &lt;a href="https://migratecontent.com/contact/"&gt;ask for a quote&lt;/a&gt; for my consulting service.&lt;/p&gt;

&lt;div class="footnotes"&gt;
    &lt;p&gt;Cover photo by &lt;a href="https://unsplash.com/@rubaitulazad?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash"&gt;Rubaitul Azad&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/text-Y9kOsyoWyaU?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash" target="_blank" rel="nofollow"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;


&lt;section class="breakout-white"&gt;
&lt;div class="breakout-inner text-center"&gt;

&lt;h2&gt;Need Help Setting Up Your Migration Environment?&lt;/h2&gt;

&lt;p&gt;I specialise in complex Drupal to WordPress migrations, including database configuration, custom SQL scripts, and troubleshooting tricky migration errors. Get a free, no-obligation consultation.&lt;/p&gt;

&lt;div class="button-container" style="margin:2em 0;"&gt;
&lt;a class="cta-button" href="https://migratecontent.com/contact/" title="Get a quote for your Drupal to WordPress migration"&gt;Get a Free Quote&lt;/a&gt;
&lt;/div&gt;

&lt;/div&gt;
&lt;/section&gt;</description><category>database</category><category>drupal</category><category>migration</category><category>mysql</category><category>wordpress</category><guid>https://migratecontent.com/how-to-set-up-mysql-for-drupal-wordpress-migrations/</guid><pubDate>Fri, 11 Jun 2021 15:44:52 GMT</pubDate></item><item><title>How to fix the mysqldump access denied process privilege error</title><link>https://migratecontent.com/how-to-fix-the-mysqldump-access-denied-process-privilege-error/</link><dc:creator>Anthony Lopez-Vito</dc:creator><description>&lt;em&gt;&lt;strong&gt;How to fix the mysqldump process privilege error after applying a recent MySQL update.&lt;/strong&gt;&lt;/em&gt;

You may receive a new 'Access denied' error when trying to dump your MySQL database:

&lt;code&gt;mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces&lt;/code&gt;

You were able to export database before so what caused this? Here's the answer: updates for MySQL 5.7.31 and MySQL 8.0.21 in July 2020 introduced an &lt;a href="https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-31.html#mysqld-5-7-31-security" target="_blank" rel="noopener noreferrer"&gt;incompatible change&lt;/a&gt;:
&lt;blockquote&gt;&lt;span class="bold"&gt;&lt;strong&gt;Incompatible Change:&lt;/strong&gt;&lt;/span&gt; Access to the &lt;a href="https://dev.mysql.com/doc/refman/5.7/en/information-schema-files-table.html" target="_blank" rel="noopener noreferrer"&gt;&lt;code&gt;INFORMATION_SCHEMA.FILES&lt;/code&gt;&lt;/a&gt; table now requires the &lt;a href="https://dev.mysql.com/doc/refman/5.7/en/privileges-provided.html#priv_process" target="_blank" rel="noopener noreferrer"&gt;&lt;code&gt;PROCESS&lt;/code&gt;&lt;/a&gt; privilege.

This change affects users of the &lt;strong&gt;mysqldump&lt;/strong&gt; command, which accesses tablespace information in the &lt;a href="https://dev.mysql.com/doc/refman/5.7/en/information-schema-files-table.html" target="_blank" rel="noopener noreferrer"&gt;&lt;code class="literal"&gt;FILES&lt;/code&gt;&lt;/a&gt; table, and thus now requires the &lt;a href="https://dev.mysql.com/doc/refman/5.7/en/privileges-provided.html#priv_process" target="_blank" rel="noopener noreferrer"&gt;&lt;code&gt;PROCESS&lt;/code&gt;&lt;/a&gt; privilege as well. Users who do not need to dump tablespace information can work around this requirement by invoking &lt;strong&gt;mysqldump&lt;/strong&gt; with the &lt;a href="https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html#option_mysqldump_no-tablespaces" target="_blank" rel="noopener noreferrer"&gt;&lt;code class="option"&gt;--no-tablespaces&lt;/code&gt;&lt;/a&gt; option. (Bug #30350829)&lt;/blockquote&gt;
This error appears when running &lt;code&gt;mysqldump&lt;/code&gt; directly from the command line, exporting the database using a client like MySQL Workbench or if you're &lt;a href="https://migratecontent.com/tag/wordpress/"&gt;managing the WordPress database&lt;/a&gt; through WP-CLI's &lt;code&gt;export&lt;/code&gt; command.

&lt;img class="aligncenter size-full wp-image-3370" src="https://migratecontent.com/wp-content/uploads/how-to-fix-the-mysqldump-access-denied-process-privilege-error-after-mysql-update.png" alt="mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces" width="800" height="120"&gt;

In my case, I encountered the problem when running a routine Python script for a &lt;a href="https://migratecontent.com/drupal-to-wordpress-migration-service/"&gt;Drupal to WordPress migration client&lt;/a&gt;. My script uses WP-CLI to export a database dump file and deploy it to a remote server.
&lt;h2&gt;Solutions for fixing the mysqldump process privilege error&lt;/h2&gt;
The &lt;code&gt;mysqldump&lt;/code&gt; command requires at least the following privilege assigned to the user:
&lt;ul&gt;
 	&lt;li&gt;SELECT privilege for dumped tables&lt;/li&gt;
 	&lt;li&gt;SHOW VIEW for dumped views&lt;/li&gt;
 	&lt;li&gt;TRIGGER for dumped triggers&lt;/li&gt;
 	&lt;li&gt;LOCK TABLES if you don't use the &lt;code&gt;--single-transaction&lt;/code&gt; option&lt;/li&gt;
 	&lt;li&gt;PROCESS if you don't use the &lt;code&gt;--no-tablespaces&lt;/code&gt; option&lt;/li&gt;
&lt;/ul&gt;
The last PROCESS privilege is new as of MySQL 5.7.31 and MySQL 8.0.21 and may be the root source of your problem. You can solve the mysqldump process privilege error in two ways:
&lt;ol&gt;
 	&lt;li&gt;Updating the privileges for your database user.&lt;/li&gt;
 	&lt;li&gt;Runing &lt;code&gt;mysqldump&lt;/code&gt; with the &lt;code&gt;--no-tablespaces&lt;/code&gt; option.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Solution 1: Update the user privileges&lt;/h3&gt;
Granting the PROCESS privilege for the user is perhaps the simplest option for fixing the &lt;code&gt;mysqldump&lt;/code&gt; process privilege error. &lt;strong&gt;Keep in mind that this option presents &lt;a href="https://migratecontent.com/how-to-fix-the-mysqldump-access-denied-process-privilege-error/#process-privilege-dangers"&gt;security issues&lt;/a&gt;&lt;/strong&gt;. You should therefore really only use this option for your own local development server installation.

To grant the PROCESS privilege, log in as an administrator user and run the following query:

&lt;code&gt;GRANT PROCESS ON *.* TO user@localhost;&lt;/code&gt;

Note that PROCESS is a global level privilege. It can't apply to individual databases. Global privileges are either administrative or apply to all databases on your MySQL server. Trying to grant them on individual databases deplays the following error:

&lt;code&gt;ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES&lt;/code&gt;

To grant the privilege to all databases you must use the &lt;code&gt;ON *.* ...&lt;/code&gt; syntax.
&lt;h3&gt;Solution 2: Use the &lt;code&gt;--no-tablespaces&lt;/code&gt; option&lt;/h3&gt;
If you cannot assign global level privileges to your user, for example, when doing so presents unacceptable security issues, you must specify the &lt;code&gt;--no-tablespaces&lt;/code&gt; option when dumping your database.

&lt;code&gt;mysqldump --no-tablespaces -u user -ppass dbname &amp;gt; db_backup_file.sql&lt;/code&gt;
&lt;h2 id="tablespaces"&gt;What are MySQL tablespaces?&lt;/h2&gt;
We are usually only concerned with logical database objects when working with databases. However, the data must be physically stored somewhere. This is where tablespaces come in. Tablespaces are physical datafiles stored in the host file system holding data for one or more tables and indexes.

The diagram below provides a handy illustration. It's from the Oracle Concepts documentation, &lt;a href="https://docs.oracle.com/cd/B19306_01/server.102/b14220/physical.htm" target="_blank" rel="noopener noreferrer"&gt;Introduction to Tablespaces, Datafiles, and Control Files&lt;/a&gt; and refers to Oracle databases. Nevertheless, it may help you understand how tablespaces relate to logical database objects and datafiles.

[caption id="attachment_3378" align="aligncenter" width="522"]&lt;img class="size-full wp-image-3378" src="https://migratecontent.com/wp-content/uploads/Oracle-Introduction-to-Tablespaces-Datafiles-and-Control-Files.gif" alt="Oracle documentation: Introduction to Tablespaces, Datafiles, and Control Files" width="522" height="405"&gt; Diagram source: &lt;a href="https://docs.oracle.com/cd/B19306_01/server.102/b14220/physical.htm" target="_blank" rel="noopener noreferrer"&gt;Oracle Concepts documentation&lt;/a&gt;[/caption]

You can therefore use the &lt;code&gt;--no-tablespaces &lt;/code&gt; option if you don't need to dump tablespace information. This may be the case for routine database dumps, for example when exporting databases for &lt;a href="https://migratecontent.com/tag/migration/"&gt;WordPress migrations&lt;/a&gt;.
&lt;h2 id="process-privilege"&gt;About the access mysqldump denied PROCESS privilege error&lt;/h2&gt;
&lt;code&gt;mysqldump&lt;/code&gt; accesses tablespace information in the FILES table. Prior to MySQL 5.7.31 and 8.0.21, your user could run &lt;code&gt;mysqldump&lt;/code&gt; without the PROCESS privilege. However, users running &lt;code&gt;mysqldump&lt;/code&gt; after the update need PROCESS privileges to access the INFORMATION_SCHEMA.FILES table. Running &lt;code&gt;mysqldump&lt;/code&gt; without PROCESS privilege ends up giving you an &lt;em&gt;Access denied&lt;/em&gt; error.
&lt;h2 id="process-privilege-dangers"&gt;Be careful with the PROCESS privilege&lt;/h2&gt;
According to the MySQL documentation, the &lt;a href="https://dev.mysql.com/doc/refman/5.7/en/privileges-provided.html#priv_process" target="_blank" rel="noopener noreferrer"&gt;PROCESS privilege&lt;/a&gt; controls access to information about statements being executed by sessions.

It is a server administration privilege and should not be given to all users. This is because it may show text from currently executing queries. Any user with the PROCESS privilege may therefore see queries issued by others. Here's the danger: these queries, such as &lt;code&gt;UPDATE user SET password=PASSWORD&lt;/code&gt;, may show secrets.

For more information, see &lt;a href="https://www.oreilly.com/library/view/mysql-reference-manual/0596002653/ch04s02.html" target="_blank" rel="noopener noreferrer"&gt;General Security Issues and the MySQL Access Privilege System&lt;/a&gt; from the O'Reilly MySQL Reference Manual.</description><category>database</category><category>mysql</category><category>sys admin</category><category>troubleshooting</category><category>upgrades</category><guid>https://migratecontent.com/how-to-fix-the-mysqldump-access-denied-process-privilege-error/</guid><pubDate>Fri, 23 Oct 2020 15:23:45 GMT</pubDate></item><item><title>How We Migrate: The Technical Process Behind a Drupal to WordPress Migration</title><link>https://migratecontent.com/how-we-migrate-technical-process/</link><dc:creator>Aiden</dc:creator><description>&lt;p class="intro"&gt;Every Drupal site is different. Custom content types, unique field configurations, contributed modules with their own database tables, and years of accumulated content that doesn't fit neatly into any template. This is why I don't use off-the-shelf migration tools. Instead, I write custom scripts tailored to each site's specific data model, and run the migration iteratively until the output is clean.&lt;/p&gt;

&lt;h2&gt;Why Custom Scripts, Not Plugins&lt;/h2&gt;

&lt;p&gt;Automated migration tools like FG Drupal to WordPress work by mapping Drupal's core database tables to their WordPress equivalents. For a basic site with standard posts and pages, this can work. However, most Drupal sites that need professional migration have outgrown standard content types.&lt;/p&gt;

&lt;p&gt;Custom content types, field collections, entity references, paragraphs modules, and bespoke database tables. These are the structures that make Drupal powerful and that make automated migration unreliable. My approach works directly against the databases, with scripts that understand your site's specific data relationships.&lt;/p&gt;

&lt;h2&gt;Phase 1: Content Audit and Mapping&lt;/h2&gt;

&lt;p&gt;Before writing any migration code, I need to understand your Drupal site's data model in detail. This means mapping every content type, field, taxonomy vocabulary, and relationship in your database.&lt;/p&gt;

&lt;h3&gt;What the Audit Covers&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Content types and their fields.&lt;/strong&gt; Every node type and its associated field definitions: text, image, file, entity reference, date, address, and any custom field types.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Taxonomy vocabularies.&lt;/strong&gt; The vocabulary structure, term hierarchies, and how terms relate to content.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;User roles and permissions.&lt;/strong&gt; Which roles exist, what they can access, and how they map to WordPress capabilities.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Media and files.&lt;/strong&gt; How files are referenced, where they're stored (public vs private filesystem), and any image style derivatives that need handling.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Custom modules and tables.&lt;/strong&gt; Bespoke functionality that stores data outside Drupal's standard schema.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The output is a mapping document that pairs each Drupal data structure with its WordPress equivalent. This document drives every subsequent decision.&lt;/p&gt;

&lt;h2&gt;Phase 2: Database Mapping&lt;/h2&gt;

&lt;p&gt;Drupal and WordPress store content in fundamentally different database architectures. Understanding these differences is essential to writing reliable migration scripts.&lt;/p&gt;

&lt;h3&gt;Core Table Mapping&lt;/h3&gt;

&lt;p&gt;At the most basic level, Drupal's &lt;code&gt;node&lt;/code&gt; table maps to WordPress's &lt;code&gt;wp_posts&lt;/code&gt;. Node IDs become post IDs, creation timestamps convert to WordPress date format, and the node status field translates to WordPress publish states. Content bodies come from a separate revisions table in Drupal and need joining before insertion.&lt;/p&gt;

&lt;h3&gt;Taxonomy Mapping&lt;/h3&gt;

&lt;p&gt;Drupal's &lt;code&gt;term_data&lt;/code&gt; (Drupal 7) and vocabulary tables map to WordPress's &lt;code&gt;wp_terms&lt;/code&gt; and &lt;code&gt;wp_term_taxonomy&lt;/code&gt;. The relationship tables that connect content to terms require their own mapping. Drupal allows multiple vocabularies with custom fields. WordPress uses categories, tags, and custom taxonomies, each with different behaviour.&lt;/p&gt;

&lt;h3&gt;Custom Fields&lt;/h3&gt;

&lt;p&gt;This is where the complexity lives. Drupal stores custom field data across multiple tables, typically one table per field, with separate columns for each property (value, format, language). WordPress stores custom fields as key-value pairs in &lt;code&gt;wp_postmeta&lt;/code&gt;, or in structured formats if using Advanced Custom Fields or similar plugins.&lt;/p&gt;

&lt;p&gt;Each custom field needs individual mapping logic. A Drupal entity reference field that links to another node might become a WordPress post relationship managed by ACF, or a simple post meta value, or a custom taxonomy, depending on how the relationship is used in the front end.&lt;/p&gt;

&lt;h2&gt;Phase 3: Migration Scripts&lt;/h2&gt;

&lt;p&gt;With the mapping document complete, I write custom scripts (typically a combination of SQL and PHP) that handle the actual data transfer. The scripts work against a copy of your production database, never against the live site.&lt;/p&gt;

&lt;p&gt;Key considerations in the scripting phase:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Data type conversions.&lt;/strong&gt; Drupal stores timestamps as Unix integers; WordPress uses &lt;code&gt;DATETIME&lt;/code&gt; strings. Status values, user roles, and content types all need transformation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Character encoding.&lt;/strong&gt; Drupal and WordPress may use different encoding for special characters, accented text, and HTML entities. The scripts handle normalisation to prevent garbled content.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Relationship integrity.&lt;/strong&gt; Content-to-taxonomy, content-to-author, and content-to-content relationships must transfer as a connected dataset. Migrating entities in isolation breaks these links.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Media file handling.&lt;/strong&gt; File references in the database need updating to point to WordPress's upload directory structure. Physical files are copied separately via rsync or similar tools.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Phase 4: Iterative Testing&lt;/h2&gt;

&lt;p&gt;This is the phase that separates professional migration from a best-effort attempt. I run the migration scripts repeatedly (typically 5 to 20 cycles per project), with each iteration refining the output.&lt;/p&gt;

&lt;h3&gt;What Each Test Cycle Checks&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Data completeness.&lt;/strong&gt; Did every piece of content come across? Are any fields missing or truncated?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Relationship integrity.&lt;/strong&gt; Are taxonomy terms correctly assigned? Do author attributions match? Are related content links valid?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Visual accuracy.&lt;/strong&gt; Does the content render correctly in the WordPress theme? Are images displaying, embeds working, and formatting intact?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Edge cases.&lt;/strong&gt; Content with unusual characters, extremely long fields, empty values, or draft states. These are the entries that break on the first pass and get fixed in subsequent cycles.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each cycle produces a test report documenting what was fixed and what needs attention in the next run. The site owner reviews key content at each stage to confirm accuracy.&lt;/p&gt;

&lt;h2&gt;Phase 5: URL Mapping and Redirects&lt;/h2&gt;

&lt;p&gt;Once the content migration is stable, I build the redirect map. Every Drupal URL alias is paired with its new WordPress URL, and 301 redirects are configured at the server level.&lt;/p&gt;

&lt;p&gt;This phase works in parallel with the SEO preservation strategy. For sites with significant organic traffic, I audit the URL list against analytics data to prioritise the pages that matter most. The redirect rules are tested before launch to ensure no high-value URLs return 404 errors.&lt;/p&gt;

&lt;h2&gt;Phase 6: Zero-Downtime Launch&lt;/h2&gt;

&lt;p&gt;For business-critical sites, downtime during migration isn't acceptable. The launch process uses a staged approach:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Build on staging.&lt;/strong&gt; The WordPress site is built and populated on a staging server, with all test cycles completed there.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Final delta migration.&lt;/strong&gt; A last-pass script migrates any content created or updated since the previous full migration.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DNS cutover.&lt;/strong&gt; DNS records are updated to point to the new WordPress server. The old Drupal site remains available as a fallback until the transition is verified.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Post-launch verification.&lt;/strong&gt; Content spot-checks, redirect testing, analytics confirmation, and search console monitoring in the first 48 hours.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The total migration timeline typically runs 4 to 12 weeks, depending on the complexity of the content model, the volume of data, and the number of test cycles needed to achieve clean output.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Related reading:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/why-automated-migration-tools-fail/"&gt;Why Automated Migration Tools Fail for Complex Drupal Sites&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/preserving-seo-drupal-wordpress-migration/"&gt;Preserving Your SEO During a Drupal to WordPress Migration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://migratecontent.com/content-migration-process/"&gt;How the migration process works&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;section class="breakout-white"&gt;
&lt;div class="breakout-inner text-center"&gt;

&lt;h2&gt;Want to Understand What Your Migration Involves?&lt;/h2&gt;

&lt;p&gt;I provide a detailed content audit and migration plan before any work begins. Get a free consultation to discuss your Drupal site's technical requirements.&lt;/p&gt;

&lt;div class="button-container" style="margin:2em 0;"&gt;
&lt;a class="cta-button" href="https://migratecontent.com/contact/" title="Get a quote for your Drupal to WordPress migration"&gt;Get a Free Quote&lt;/a&gt;
&lt;/div&gt;

&lt;/div&gt;
&lt;/section&gt;</description><category>database</category><category>drupal</category><category>migration</category><category>technical</category><category>wordpress</category><guid>https://migratecontent.com/how-we-migrate-technical-process/</guid><pubDate>Wed, 20 Mar 2019 09:00:00 GMT</pubDate></item><item><title>How to change the WordPress table prefix prior to a migration</title><link>https://migratecontent.com/change-wordpress-table-prefix-prior-migration/</link><dc:creator>Anthony Lopez-Vito</dc:creator><description>&lt;p&gt;When working on a &lt;a href="https://migratecontent.com/drupal-to-wordpress-migration-service/"&gt;Drupal to WordPress migration&lt;/a&gt; project, I like to migrate into a set of intermediary WordPress tables that live in the Drupal database. These are working tables where I can run various scripts to process and clean up the content before exporting to a working WordPress installation. It's not &lt;em&gt;necessary&lt;/em&gt; to do this but I find it convenient to run scripts on the same database rather than deal with two separate database connections.&lt;/p&gt;


&lt;figure class="figure d-flex flex-column align-items-center"&gt;
    &lt;img src="https://migratecontent.com/images/gavin-allanwood-q92hWEdK8p8-unsplash.jpg" alt="Overhead image of cafe tables" class="figure-img img-fluid rounded" width="800" height="533"&gt;
&lt;/figure&gt;

&lt;p&gt;Note that some people suggest renaming the table prefixes to improve security. My use of the table prefixes is simply to create temporary containers for the migration. While non-standard prefixes might help prevent 'script kiddie' attacks, I find it isn't worth the disadvantages that come with this sort of &lt;a href="https://en.wikipedia.org/wiki/Security_through_obscurity"&gt;security through obscurity&lt;/a&gt; (or more precisely, &lt;a href="https://en.wikipedia.org/wiki/Security_through_obscurity#Security_through_minority"&gt;security through minority&lt;/a&gt;) approach. Here are two articles give a deeper explanation of topic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;wordfence.com: &lt;a href="https://www.wordfence.com/blog/2016/12/wordpress-table-prefix/"&gt;WordPress Table Prefix: Changing It Does Nothing to Improve Security&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;wpkrauts.com: &lt;a href="https://web.archive.org/web/20150129082218/http://wpkrauts.com/2015/the-database-prefix-is-not-a-security-feature/"&gt;The database table prefix is not a security feature&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;SQL queries to change the WordPress table prefixes&lt;/h2&gt;
&lt;p&gt;You can start with a freshly installed WordPress database. Dumping this and importing to your Drupal migration database will give you all the tables with the correct WordPress schema. I use the &lt;em&gt;acc_&lt;/em&gt; prefix but you can use whatever you want.&lt;/p&gt;
&lt;p&gt;Rename the tables with these queries:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;RENAME table `wp_commentmeta` TO `acc_commentmeta`;
RENAME table `wp_comments` TO `acc_comments`;
RENAME table `wp_links` TO `acc_links`;
RENAME table `wp_options` TO `acc_options`;
RENAME table `wp_postmeta` TO `acc_postmeta`;
RENAME table `wp_posts` TO `acc_posts`;
RENAME table `wp_terms` TO `acc_terms`;
RENAME table `wp_termmeta` TO `acc_termmeta`;
RENAME table `wp_term_relationships` TO `acc_term_relationships`;
RENAME table `wp_term_taxonomy` TO `acc_term_taxonomy`;
RENAME table `wp_usermeta` TO `acc_usermeta`;
RENAME table `wp_users` TO `acc_users`;&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Testing the migration results&lt;/h2&gt;
&lt;p&gt;If you need to point a WordPress installation to these tables for testing, you'll need to do two things:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Update the &lt;em&gt;$table_prefix&lt;/em&gt; setting in the &lt;em&gt;wp-options.php&lt;/em&gt; file&lt;/li&gt;
&lt;li&gt;Update the &lt;em&gt;options&lt;/em&gt; and &lt;em&gt;usermeta&lt;/em&gt; tables&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Updating the &lt;em&gt;$table_prefix&lt;/em&gt; setting in the &lt;em&gt;wp-options.php&lt;/em&gt; file is straightforward. Open the file and edit the line:&lt;/p&gt;
&lt;pre&gt;$table_prefix  = 'acc_';&lt;/pre&gt;
&lt;p&gt;In WordPress, prefixes are saved as entries in the &lt;em&gt;options&lt;/em&gt; and &lt;em&gt;usermeta&lt;/em&gt; table. Check for entries containing the prefix:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;SELECT * FROM `acc_options` WHERE `option_name` LIKE '%wp_%';
SELECT * FROM `acc_usermeta` WHERE `meta_key` LIKE '%wp_%';&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When you have all the entries, update them with the new prefix. The query will probably look something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;UPDATE `acc_options` SET `option_name` = 'acc_user_roles' WHERE `option_name` = 'wp_user_roles';
UPDATE `acc_usermeta` SET `meta_key` = 'acc_capabilities' WHERE `meta_key` = 'wp_capabilities';
UPDATE `acc_usermeta` SET `meta_key` = 'acc_user_level' WHERE `meta_key` = 'wp_user_level';
UPDATE `acc_usermeta` SET `meta_key` = 'acc_user-settings-time' WHERE `meta_key` = 'wp_user-settings-time';
UPDATE `acc_usermeta` SET `meta_key` = 'acc_user-settings' WHERE `meta_key` = 'wp_user-settings';
UPDATE `acc_usermeta` SET `meta_key` = 'acc_dashboard_quick_press_last_post_id' WHERE `meta_key` = 'wp_dashboard_quick_press_last_post_id';
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;A word of warning:&lt;/strong&gt; it's easy to forget to change the prefixes back to match the final WordPress installation. If you do, the WordPress user accounts will have problems, such as the Dashboard controls not being visible after logging in. Because of this, I tend to have a separate testing installation that gets an import of the working tables.&lt;/p&gt;

&lt;div class="footnotes"&gt;
&lt;p&gt;Cover photo by &lt;a href="https://unsplash.com/@gavla?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash" target="_blank" rel="nofollow"&gt;Gavin Allanwood&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/aerial-photo-of-grey-tables-q92hWEdK8p8?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash" target="_blank" rel="nofollow"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;


&lt;section class="breakout-white"&gt;
&lt;div class="breakout-inner text-center"&gt;

&lt;h2&gt;Need Help With Your Drupal to WordPress Migration?&lt;/h2&gt;

&lt;p&gt;I specialise in complex Drupal to WordPress migrations, including database preparation, table prefix management, and post-migration testing. Get a free, no-obligation consultation.&lt;/p&gt;

&lt;div class="button-container" style="margin:2em 0;"&gt;
&lt;a class="cta-button" href="https://migratecontent.com/contact/" title="Get a quote for your Drupal to WordPress migration"&gt;Get a Free Quote&lt;/a&gt;
&lt;/div&gt;

&lt;/div&gt;
&lt;/section&gt;</description><category>database</category><category>drupal</category><category>migration</category><category>sql</category><category>wordpress</category><guid>https://migratecontent.com/change-wordpress-table-prefix-prior-migration/</guid><pubDate>Thu, 16 Mar 2017 13:12:02 GMT</pubDate></item><item><title>Migrating Bare Bones Yojimbo to WordPress</title><link>https://migratecontent.com/migrating-bare-bones-yojimbo-wordpress/</link><dc:creator>Anthony Lopez-Vito</dc:creator><description>&lt;p&gt;In a &lt;a href="https://migratecontent.com/yojimbo-to-tomboy-notes-migration-tool/"&gt;previous post&lt;/a&gt;, I wrote about exporting data from Bare Bones Software's Yojimbo and using &lt;a href="https://wiki.gnome.org/Apps/Tomboy"&gt;Tomboy&lt;/a&gt; as an alternative. My migration script scraped the content from Yojimbo Sidekick and wrote XML files in Tomboy Note format. Though there were some drawbacks, such as tags being unavailable in Yojimbo Sidekick, I thought Tomboy's search feature would be adequate. A couple of weeks trialling Tomboy proved that it wasn't going to be a Yojimbo killer. Tomboy can't compete in terms of overall usability and though it'll work on my Linux and OS X machines, note synchronisation takes &lt;a href="https://wiki.gnome.org/Apps/Tomboy/Synchronization"&gt;some setup&lt;/a&gt; that didn't warrant further time investment.&lt;/p&gt;

&lt;p&gt;Once again I turned to WordPress as an easy solution. There's a risk of seeing WordPress as my hammer for everything that looks like a nail but it has taxonomies, a reliable-enough search functionality and being web-based, works across all my devices. I'm very familiar with the platform and have already built up my own set of tools to export and migrate content. Why &lt;em&gt;not&lt;/em&gt; use WordPress? Getting data out of Yojimbo was another issue. The quick and easy Yojimbo Sidekick route already proved inadequate so it was time to dig in and reverse engineer Yojimbo's storage mechanism.&lt;/p&gt;

&lt;h2&gt;Analysing and exporting the Yojimbo database&lt;/h2&gt;

&lt;p&gt;'Reverse engineering' turned out to be too lofty a term for the task. It was obvious after quick look that Yojimbo uses an SQLite database to store information. Firing up &lt;a href="http://sqlitebrowser.org/" title="DB Browser for SQLite "&gt;DB4S&lt;/a&gt; to analyse the tables and bit of analysis revealed the tables, columns and relationships that are important for exporting our notes. The columns are a little oddly named but it didn't take long to figure out the necessary fields for migrating to WordPress.&lt;/p&gt;

&lt;table width="60%" class="table-bordered"&gt;
&lt;caption&gt;Table: ZITEM&lt;/caption&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th width="10%"&gt;Column&lt;/th&gt;
&lt;th width="50%"&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class="odd row-first"&gt;
&lt;td&gt;ZBLOB&lt;/td&gt;
&lt;td&gt;This looks like an ID&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="even"&gt;
&lt;td&gt;ZNAME&lt;/td&gt;
&lt;td&gt;The Yojimbo note title&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="odd"&gt;
&lt;td&gt;Z_PK&lt;/td&gt;
&lt;td&gt;The ID to the Z_15TAGS relationship table&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;table width="60%" class="table-bordered"&gt;
&lt;caption&gt;Table: ZTAG&lt;/caption&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th width="10%"&gt;Column&lt;/th&gt;
&lt;th width="50%"&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class="odd row-first"&gt;
&lt;td&gt;Z_PK&lt;/td&gt;
&lt;td&gt;The Tag ID&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="even"&gt;
&lt;td&gt;ZNAME&lt;/td&gt;
&lt;td&gt;The tag name&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;table width="60%" class="table-bordered"&gt;
&lt;caption&gt;Table: ZBLOBLSTRINGREP&lt;/caption&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th width="10%"&gt;Column&lt;/th&gt;
&lt;th width="50%"&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class="odd row-first"&gt;
&lt;td&gt;ZBLOB&lt;/td&gt;
&lt;td&gt;ID&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="even"&gt;
&lt;td&gt;ZSTRING&lt;/td&gt;
&lt;td&gt;String for unencrypted item&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;table width="60%" class="table-bordered"&gt;
&lt;caption&gt;Table: Z_15TAGS&lt;/caption&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th width="10%"&gt;Column&lt;/th&gt;
&lt;th width="50%"&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class="odd row-first"&gt;
&lt;td&gt;Z_15ITEMS1&lt;/td&gt;
&lt;td&gt;Relationship ID&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="even"&gt;
&lt;td&gt;Z_25ITAGS&lt;/td&gt;
&lt;td&gt;Tag ID&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;img src="https://migratecontent.com/images/yojimbo-tables.jpg" alt="Yojimbo SQLite tables" width="363" height="213" class="aligncenter size-full wp-image-1822"&gt;

&lt;p&gt;It became a simple matter of tweaking my Drupal to WordPress migration queries to extract from the Yojimbo database and create WordPress posts. Unlike with the Tomboy Notes route, it was possible to recreate the tags, which is what makes Yojimbo so useful. One drawback is that I haven't figured out how to extract encrypted notes but I didn't use Yojimbo to store important encrypted information so that wasn't a priority.&lt;/p&gt;

&lt;h2&gt;WordPress as a Yojimbo alternative&lt;/h2&gt;

&lt;p&gt;Using WordPress as a Yojimbo alternative might not work for everyone but after several months use, I've found it to be an excellent cross-platform replacement. The installation and database runs on a NAS drive connected to my local network so is accessible to all my devices. Standard WordPress taxonomies, search and plugins makes content management simple once you've imported the Yojimbo content. In fact, by migrating away from Yojimo, I've ended up creating my own full-blown personal knowledge management system.&lt;/p&gt;

&lt;p&gt;If you need to export your Yojimbo notes to a cross-platform alternative, give WordPress a try. You can grab my migration script from &lt;a href="https://gitlab.com/anthonylv/pyYojimboMigrate" title="pyYojimboMigrate: Yojimbo to WordPress export and migration"&gt;GitLab&lt;/a&gt; but please keep in mind that it was a quick hack to achieve a specific one-time objective. You may need to hack it to suit your own setup.&lt;/p&gt;</description><category>database</category><category>migration</category><category>sql</category><category>tomboy</category><category>wordpress</category><category>yojimbo</category><guid>https://migratecontent.com/migrating-bare-bones-yojimbo-wordpress/</guid><pubDate>Wed, 04 Jan 2017 11:28:07 GMT</pubDate></item><item><title>Importing a WordPress database: How to fix the Unknown collation: 'utf8mb4_unicode_ci' error</title><link>https://migratecontent.com/wordpress-how-to-fix-unknown-collation-error/</link><dc:creator>Anthony Lopez-Vito</dc:creator><description>If you do a lot of exporting and importing to different database servers, you'll be familiar with the frustration of encountering MySQL import errors. Every so often when importing a WordPress dump file into a client's database, I will encounter an &lt;em&gt;Unknown collation&lt;/em&gt; error like the following:

&lt;code&gt;Unknown collation: 'utf8mb4_unicode_ci'&lt;/code&gt;

Sometimes it will come up as:

&lt;code&gt;Unknown collation: 'utf8mb4_unicode_520_ci'&lt;/code&gt;

This is caused by a difference in encoding types between the source and destination databases. It usually happens when you export from a newer MySQL database (MySQL 5.5.3 and above) which &lt;a href="https://dev.mysql.com/doc/refman/5.7/en/charset-unicode-utf8mb4.html"&gt;uses &lt;code&gt;utf8mb4&lt;/code&gt;&lt;/a&gt;, then attempt to import into an older version using &lt;code&gt;utf8&lt;/code&gt;. If you are importing from a dump file generated from a MySQL 5.6 database, you may get the &lt;em&gt;utf8mb4_unicode_520_ci&lt;/em&gt; message. The &lt;em&gt;520&lt;/em&gt; refers to &lt;a title="utf8mb4_unicode_520_ci: Unicode Collation Algorithm new version" href="https://dev.mysql.com/worklog/task/?id=2673#tabs-2673-4"&gt;MySQL's use of&lt;/a&gt; Unicode Collation Algorithm 5.2.0. Unknown collation errors may also happen if you are trying to import a &lt;a title="MariaDB versus MySQL - Compatibility" href="https://mariadb.com/kb/en/mariadb/mariadb-vs-mysql-compatibility/"&gt;MariaDB&lt;/a&gt; database into MySQL. I tend to get &lt;em&gt;unknown collation&lt;/em&gt; errors with my Rackspace Cloud accounts after Rackspace started offering MariaDB as a database option.

Ideally one would upgrade the older destination database but this isn't always a realistic option. There are a number of discussion threads on the &lt;a href="https://wordpress.org/support/topic/collation-error-utf8-mb4#post-6884157"&gt;WordPress forum&lt;/a&gt; about what to do. Fortunately, many web hosting accounts have a phpMyAdmin interface which provides an easy work-around for the problem.
&lt;h2&gt;Format-specific options during a phpMyAdmin database export&lt;/h2&gt;
&lt;ol&gt;
 	&lt;li&gt;Log in to your database server using phpMyAdmin&lt;/li&gt;
 	&lt;li&gt;Make sure you select your database and go to the "Export" tab&lt;/li&gt;
 	&lt;li&gt;Select the "Custom" radio button&lt;/li&gt;
 	&lt;li&gt;Go the section "Format-specific options" and in the setting for "Database system or older MySQL server to maximize output compatibility with:" select &lt;strong&gt;MYSQL40&lt;/strong&gt;.&lt;/li&gt;
 	&lt;li&gt;Scroll to the bottom and click &lt;strong&gt;GO&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;!-- image removed: phpmyadmin-format-specific-options.png --&gt;

Other possible solutions include:
&lt;ul&gt;
 	&lt;li&gt;&lt;a title="Unknown collation question on stackoverflow" href="http://stackoverflow.com/a/31506831"&gt;doing a search and replace&lt;/a&gt; on the database dump file;&lt;/li&gt;
 	&lt;li&gt;&lt;a href="http://stackoverflow.com/a/30005743"&gt;converting the character set&lt;/a&gt; to &lt;code&gt;utf8_general_ci&lt;/code&gt;;&lt;/li&gt;
 	&lt;li&gt;converting the database for &lt;a href="https://mathiasbynens.be/notes/mysql-utf8mb4"&gt;full Unicode support&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
Since many of my WordPress database migrations are under my &lt;a title="Drupal to WordPress migration service" href="https://migratecontent.com/drupal-to-wordpress-migration-service/"&gt;migration service&lt;/a&gt;, I don't always have control over the client's platform. The phpMyAdmin export format method is often the simplest solution.
&lt;h2&gt;Side-effects of a character encoding downgrade&lt;/h2&gt;
You might be wondering about the purpose of encoding types and if there will be any side-effects of downgrading. Character encoding allows support for a set of characters, such as the Western alphabet, Asian scripts and non-alphanumeric symbols. Older &lt;code&gt;utf8&lt;/code&gt; databases support a smaller set of characters whereas &lt;code&gt;utf8mb4&lt;/code&gt; includes &lt;a title="Emoji, WordPress, and You" href="https://kraft.im/2015/03/emoji-wordpress-and-you/"&gt;emojis, musical notation and Chinese Han characters&lt;/a&gt;. If you've ever exported a website from one CMS to another and found random characters scattered throughout the copy, it's because of an incompatible character encoding.

Solving the &lt;em&gt;unknown collation&lt;/em&gt; error as described here could mean you'll end up with unsupported characters after your site migration. However, as with many of my &lt;a title="Drupal to WordPress migration tool" href="https://migratecontent.com/drupal-to-wordpress-migration-tool/"&gt;Drupal to WordPress migration&lt;/a&gt; clients, in all likelihood you'll be migrating &lt;em&gt;from an older&lt;/em&gt; &lt;code&gt;utf8&lt;/code&gt; Drupal database &lt;em&gt;to a newer&lt;/em&gt; &lt;code&gt;utf8mb4&lt;/code&gt;-supported WordPress database. In this case, your old content will not have characters that will cause a problem after an encoding downgrade.</description><category>character</category><category>database</category><category>drupal</category><category>encoding</category><category>migration</category><category>troubleshooting</category><category>wordpress</category><guid>https://migratecontent.com/wordpress-how-to-fix-unknown-collation-error/</guid><pubDate>Fri, 13 May 2016 14:57:04 GMT</pubDate></item><item><title>Drupal to WordPress migration SQL queries explained</title><link>https://migratecontent.com/drupal-to-wordpress-migration-sql-queries-explained/</link><dc:creator>Anthony Lopez-Vito</dc:creator><description>&lt;figure&gt;&lt;img src="https://migratecontent.com/images/drupal-to-wordpress-migration-queries-featured.jpg"&gt;&lt;/figure&gt; &lt;p&gt;In this post I will give a step-by-step explanation of my Drupal to WordPress migration SQL queries. For general information about migrating from Drupal to WordPress, please see instead my &lt;strong&gt;&lt;em&gt;&lt;a href="https://migratecontent.com/how-we-migrate-technical-process/"&gt;Drupal to WordPress Migration Guide&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;. &lt;/p&gt;

&lt;figure class="figure d-flex flex-column align-items-center"&gt;
    &lt;img class="figure-img img-fluid rounded" src="https://migratecontent.com/images/drupal-to-wordpress-migration-queries-screenshot.png" title="Drupal to Wordpress migration SQL queries" alt="Drupal to Wordpress migration queries screenshot" width="800" height="493"&gt;
&lt;/figure&gt;

&lt;p&gt;Since I &lt;a href="https://migratecontent.com/contact/"&gt;offer site migration&lt;/a&gt; as a &lt;a href="https://migratecontent.com/drupal-to-wordpress-migration-service/" title="Drupal to WordPress migration service"&gt;paid service&lt;/a&gt;, readers might be wondering why I'm giving away some of my secret sauce. The simple answer is that the ingredients of the sauce are anything but secret. A web search brings up blog posts and tutorials detailing how to go about it. In fact, the first version of my own Drupal to WordPress migration tool was based on a blog post by another &lt;a href="http://blog.room34.com/archives/4530"&gt;web company&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;However, while the knowledge is freely available, the whole process can be a real pain, especially when you're dealing with a Drupal installation with lots of content and customisations. In my experience, migrating an established site from Drupal to WordPress requires &lt;em&gt;all&lt;/em&gt; of the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An intermediate to advanced level of technical skill;&lt;/li&gt;
&lt;li&gt;Time to plan, run the migration and do post-migration clean-up;&lt;/li&gt;
&lt;li&gt;A great deal of patience.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you are a developer with the right skills, you still need to consider the time investment and effort needed to understand both Drupal and WordPress database schemas. Often, the man-hours required will make a client think twice about proceeding with the project. Fortunately (or unfortunately) for me, I've needed to put in the time because my maintenance agreements for some clients covered exactly this sort of work. I've therefore built up enough experience to offer competitive quotes for migration of even complex sites. In my very biased opinion, you'll make better use of your time and budget by getting me to do the task!&lt;/p&gt;
&lt;p&gt;Of course, there are still cases where, for whatever reason, it's not viable to offload the work to someone else. If this sounds like your situation, you'll probably figure things out eventually so I might as well help you along.&lt;/p&gt;
&lt;h2&gt;Prerequisites for the Drupal to WordPress migration script&lt;/h2&gt;
&lt;p&gt;To run this migration you will need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A working installation of Drupal 6;&lt;/li&gt;
&lt;li&gt;A clean installation of WordPress 3.5 or above;&lt;/li&gt;
&lt;li&gt;Access to the Drupal and WordPress MySQL databases;&lt;/li&gt;
&lt;li&gt;The ability to run SQL queries on both databases;&lt;/li&gt;
&lt;li&gt;Both databases on the same MySQL server;&lt;/li&gt;
&lt;li&gt;Access to the Drupal and WordPress installations.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ideally, you should:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Run the migration from a development server (it's best not to risk running this on your live server);&lt;/li&gt;
&lt;li&gt;Backup your live Drupal database before beginning the migration;&lt;/li&gt;
&lt;li&gt;Be comfortable with running database operations;&lt;/li&gt;
&lt;li&gt;Have planned the migration beforehand (e.g. which content types and taxonomies should be migrated).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you have an older version of Drupal, simply upgrade to Drupal 6 first, then run the migration. I mention WordPress 3.5 as a prerequisite because that's where I've done most testing. You can probably get away with migrating straight into a more recent version but to avoid any problems, I suggest you start off with WordPress 3.5. It's easy to upgrade to the latest WordPress version &lt;em&gt;after&lt;/em&gt; converting the Drupal content.&lt;/p&gt;
&lt;h2&gt;The Drupal to WordPress migration SQL queries&lt;/h2&gt;
&lt;p&gt;Keep in mind that this article is based on my Drupal to WordPress migration tool but with some additional queries written for the specific needs of a client. It therefore includes some values which will not apply to your site. I've stripped out any identifying information but left generic data to provide an example. &lt;em&gt;You will need to manually look up the correct values in the Drupal database for your installation.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Another thing to keep in mind is that I've favoured readability over efficiency. For example, it's possible to write more complex queries to avoid creating working tables but that would make debugging more difficult. Having a trail of data changes can help with content analysis if the end results aren't what you expected.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;strong&gt;CAUTION:&lt;/strong&gt; Make a backup of both your Drupal and WordPress databases before running these queries. USE IS ENTIRELY AT YOUR OWN RISK. I'm offering this information with no warranty or support implied.&lt;/div&gt;
&lt;h3&gt;Example data in this scenario&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;wordpress:&lt;/em&gt; the WordPress database name.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;drupal:&lt;/em&gt; the Drupal database name.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;acc_ table prefixes:&lt;/em&gt; these are working tables I create to help with migrating data.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Clear out some Drupal and WordPress tables&lt;/h3&gt;
&lt;p&gt;For most migration projects to date, I've needed to run through several passes of the queries as I make incremental adjustments based on the client's feedback. I define a &lt;em&gt;'pass'&lt;/em&gt; as one iteration of the entire migration process and inspecting the results in a WordPress installation. Depending on your project requirements, you may need to do this several times, making little tweaks to the MySQL queries as you go along.&lt;/p&gt;
&lt;p&gt;These Drupal and WordPress tables may be empty or non-existent if you're running the queries for the first time but it makes sense to clear them out at the start.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
TRUNCATE TABLE wordpress.wp_comments;
TRUNCATE TABLE wordpress.wp_links;
TRUNCATE TABLE wordpress.wp_postmeta;
TRUNCATE TABLE wordpress.wp_posts;
TRUNCATE TABLE wordpress.wp_term_relationships;
TRUNCATE TABLE wordpress.wp_term_taxonomy;
TRUNCATE TABLE wordpress.wp_terms;
TRUNCATE TABLE wordpress.wp_users;

DROP TABLE IF EXISTS drupal.acc_duplicates;
DROP TABLE IF EXISTS drupal.acc_news_terms;
DROP TABLE IF EXISTS drupal.acc_tags_terms;
DROP TABLE IF EXISTS drupal.acc_wp_tags;
DROP TABLE IF EXISTS drupal.acc_users_post_count;
DROP TABLE IF EXISTS drupal.acc_users_comment_count;
DROP TABLE IF EXISTS drupal.acc_users_with_content;
DROP TABLE IF EXISTS drupal.acc_users_post_count;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;For some installations, I make changes to the wp_usermeta table so that needs to be cleared too.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
TRUNCATE TABLE wordpress.wp_usermeta;
&lt;/pre&gt;&lt;/div&gt;

&lt;h3&gt;Vocabularies and taxonomies&lt;/h3&gt;
&lt;p&gt;Delete unwanted vocabularies. You'll need to look in your Drupal &lt;em&gt;vocabulary&lt;/em&gt; table for the appropriate &lt;em&gt;vid&lt;/em&gt;s. In this case, I'm deleting vocabularies &lt;em&gt;5, 7, 8, 38&lt;/em&gt; and &lt;em&gt;40&lt;/em&gt;.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
DELETE FROM drupal.vocabulary WHERE vid IN (5, 7, 8, 38, 40);
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Delete terms associated with unwanted vocabularies. Here I'm keeping the terms for &lt;em&gt;vid 38&lt;/em&gt;. Sometimes you might want to keep some terms of unwanted vocabularies for later conversion into into WordPress tags. (Please see the next query.)&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
DELETE FROM drupal.term_data WHERE vid IN (5, 7, 8, 40);
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You may want to merge terms. In this example, I am merging the previously saved terms for &lt;em&gt;News&lt;/em&gt; which has &lt;em&gt;vid 38&lt;/em&gt; to the &lt;em&gt;Tags&lt;/em&gt; vocabulary terms which has &lt;em&gt;vid 2&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;We will need to deal with duplicates. For example, in the Drupal installation, &lt;em&gt;'science'&lt;/em&gt; could appear in both &lt;em&gt;News (vid 38)&lt;/em&gt; and &lt;em&gt;Tags (vid 2)&lt;/em&gt;. This will cause a problem when exporting to WordPress since we can't have duplicate terms. Here I create working tables for both term groups.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
CREATE TABLE drupal.acc_news_terms AS SELECT tid, vid, name FROM drupal.term_data WHERE vid=38;
CREATE TABLE drupal.acc_tags_terms AS SELECT tid, vid, name FROM drupal.term_data WHERE vid=2;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Create a working table from duplicates.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
CREATE TABLE drupal.acc_duplicates AS
	SELECT t.tid tag_tid,
		n.tid news_tid,
		t.vid tag_vid,
		n.vid news_vid,
		t.name
FROM drupal.acc_tags_terms AS t
INNER JOIN (drupal.acc_news_terms AS n)
ON n.name=t.name;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Append a string to &lt;em&gt;News&lt;/em&gt; terms duplicates so they won't clash during migration. Here I used a fixed string but this won't work if you have more than two terms with the same name. If you expect many terms with the same name, it would be better to generate a unique number. For example, using the &lt;em&gt;tid&lt;/em&gt; would make it unique since these are unique primary keys. Use whatever string makes sense for your project.&lt;/p&gt;
&lt;p&gt;Note that we're overwriting the source data in the Drupal &lt;em&gt;term_data&lt;/em&gt; table so proceed with care. Make sure you have a backup of your pre-migration Drupal tables in case you need to run the conversion again.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
UPDATE drupal.term_data
	SET name=CONCAT(name, '_01')
	WHERE tid IN (SELECT news_tid FROM drupal.acc_duplicates);
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Convert Drupal &lt;em&gt;News&lt;/em&gt; terms to Drupal &lt;em&gt;Tags&lt;/em&gt;. We'll migrate the whole lot into WordPress tags later.&lt;/p&gt;
&lt;div class="codelisting"&gt;
UPDATE drupal.term_data SET vid=2 WHERE vid=38;
&lt;/div&gt;

&lt;p&gt;Create a table of WordPress tags. Exclude any terms from Drupal vocabularies that you might later migrate into WordPress categories. See the MySQL queries below where I create WordPress categories and sub-categories.&lt;/p&gt;
&lt;p&gt;Here, all Drupal vocabularies except &lt;em&gt;37, 36&lt;/em&gt; and &lt;em&gt;35&lt;/em&gt; will be converted WordPress tags.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
CREATE TABLE drupal.acc_wp_tags AS
	SELECT
		tid,
		vid,
		name
	FROM drupal.term_data
	WHERE vid NOT IN (37, 36, 35);
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now create the tags in the WordPress database. A clean WordPress database will have &lt;em&gt;term_id=1&lt;/em&gt; for &lt;em&gt;'Uncategorized'&lt;/em&gt;. Use REPLACE as this may conflict with a Drupal tid.&lt;/p&gt;
&lt;p&gt;We are assuming that this point the Drupal &lt;em&gt;term_data&lt;/em&gt; table has been cleaned of any duplicate names. Any duplicate terms will be lost when running this MySQL query.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
REPLACE INTO wordpress.wp_terms (term_id, name, slug, term_group)
	SELECT
		d.tid,
		d.name,
		REPLACE(LOWER(d.name), ' ', '_'),
		d.vid
	FROM drupal.term_data d WHERE d.tid IN (
		SELECT t.tid FROM drupal.acc_wp_tags t
		);
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In WordPress, tags and categories are all stored in the &lt;em&gt;wp_term_taxonomy&lt;/em&gt; table. The &lt;em&gt;taxonomy&lt;/em&gt; field specifies whether it's a tag or category by setting the field string to either &lt;em&gt;'post_tag'&lt;/em&gt; or &lt;em&gt;'category'&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Here I convert these Drupal terms into WordPress tags.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
REPLACE INTO wordpress.wp_term_taxonomy (
		term_taxonomy_id,
		term_id,
		taxonomy,
		description,
		parent)
	SELECT DISTINCT
		d.tid,
		d.tid 'term_id',
		'post_tag', /* This string makes them WordPress tags */
		d.description 'description',
		0 /* In this case, I don't give tags a parent */
	FROM drupal.term_data d
	WHERE d.tid IN (SELECT t.tid FROM drupal.acc_wp_tags t);
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Create the categories and sub-categories in the WordPress database. This may be unnecessary depending on your setup.&lt;/p&gt;
&lt;p&gt;Add terms associated with a Drupal vocabulary into WordPress. Note that in this case, these are the same vids that I excluded from the tag table above.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
REPLACE INTO wordpress.wp_terms (term_id, name, slug, term_group)
	SELECT DISTINCT
		d.tid,
		d.name,
		REPLACE(LOWER(d.name), ' ', '_'),
		d.vid
	FROM drupal.term_data d
	WHERE d.vid IN (37, 36, 35);
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Convert these Drupal terms into WordPress sub-categories by setting the &lt;em&gt;parent&lt;/em&gt; field in the &lt;em&gt;wp_term_taxonomy&lt;/em&gt; table.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
REPLACE INTO wordpress.wp_term_taxonomy (
		term_taxonomy_id,
		term_id,
		taxonomy,
		description,
		parent)
	SELECT DISTINCT
		d.tid,
		d.tid 'term_id',
		'category',
		d.description 'description',
		d.vid
	FROM drupal.term_data d
	WHERE d.vid IN (37, 36, 35);
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now add the vocabularies to the WordPress &lt;em&gt;terms&lt;/em&gt; table. There's no need to set &lt;em&gt;term_id&lt;/em&gt; as vocabularies are not directly associated with posts.&lt;/p&gt;
&lt;div class="codelisting"&gt;
INSERT INTO wordpress.wp_terms (name, slug, term_group)
	SELECT DISTINCT
		v.name,
		REPLACE(LOWER(v.name), ' ', '_'),
		v.vid
	FROM drupal.vocabulary v
	WHERE vid IN (37, 36, 35);
&lt;/div&gt;
&lt;p&gt;Insert Drupal vocabularies as WordPress categories.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
INSERT INTO wordpress.wp_term_taxonomy (
		term_id,
		taxonomy,
		description,
		parent,
		count)
	SELECT DISTINCT
		v.vid,
		'category', /* This string makes them WordPress categories */
		v.description,
		v.vid,
		0
	FROM drupal.vocabulary v
	WHERE vid IN (37, 36, 35);
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Update the WordPress term groups and parents.&lt;/p&gt;
&lt;p&gt;Before continuing with this step, we need to manually inspect the table to get the &lt;em&gt;term_id&lt;/em&gt; for the parents inserted above. In this case, vids &lt;em&gt;37, 36&lt;/em&gt; and &lt;em&gt;35&lt;/em&gt; were inserted as into the &lt;em&gt;wp_term_taxonomy&lt;/em&gt; table as &lt;em&gt;term_ids 7517, 7518&lt;/em&gt; and &lt;em&gt;7519&lt;/em&gt;. I will use them as the parents for their respective terms. In other words, terms that formerly belonged to the Drupal vocabulary ID &lt;em&gt;37&lt;/em&gt; would now belong to the WordPress parent category &lt;em&gt;7519&lt;/em&gt;.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
&lt;p&gt;UPDATE wordpress.wp_terms SET term_group=7519 WHERE term_group=37;
UPDATE wordpress.wp_terms SET term_group=7518 WHERE term_group=36;
UPDATE wordpress.wp_terms SET term_group=7517 WHERE term_group=35;&lt;/p&gt;
&lt;p&gt;UPDATE wordpress.wp_term_taxonomy SET parent=7519 WHERE parent=37;
UPDATE wordpress.wp_term_taxonomy SET parent=7518 WHERE parent=36;
UPDATE wordpress.wp_term_taxonomy SET parent=7517 WHERE parent=35;&lt;/p&gt;
&lt;p&gt;UPDATE wordpress.wp_term_taxonomy SET term_id=7519 WHERE term_taxonomy_id=7519;
UPDATE wordpress.wp_term_taxonomy SET term_id=7518 WHERE term_taxonomy_id=7518;
UPDATE wordpress.wp_term_taxonomy SET term_id=7517 WHERE term_taxonomy_id=7517;
&lt;/p&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Re-insert the &lt;em&gt;Uncategorized&lt;/em&gt; term replaced earlier in the conversion process. We may have replaced or deleted the Uncategorized category during a previous MySQL query. Re-insert it if you want an Uncategorized category.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
INSERT INTO wordpress.wp_terms (name, slug, term_group)
	VALUES ('Uncategorized', 'uncategorized', 0);
INSERT INTO wordpress.wp_term_taxonomy (
		term_taxonomy_id,
		term_id,
		taxonomy,
		description,
		parent,
		count)
	SELECT DISTINCT
		t.term_id,
		t.term_id,
		'category',
		t.name,
		0,
		0
	FROM wordpress.wp_terms t
	WHERE t.slug='uncategorized';
&lt;/pre&gt;&lt;/div&gt;

&lt;h3&gt;Converting Drupal nodes to WordPress posts&lt;/h3&gt;
&lt;p&gt;Now create WordPress posts from Drupal nodes. This may take a while if you have many Drupal nodes. Wait until the query completes before continuing. It could take several minutes.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
REPLACE INTO wordpress.wp_posts (
		id,
		post_author,
		post_date,
		post_content,
		post_title,
		post_excerpt,
		post_name,
		post_modified,
		post_type,
		post_status,
		to_ping,
		pinged,
		post_content_filtered)
	SELECT DISTINCT
		n.nid 'id',
		n.uid 'post_author',
		DATE_ADD(FROM_UNIXTIME(0), interval n.created second) 'post_date',
		r.body 'post_content',
		n.title 'post_title',
		r.teaser 'post_excerpt',
		IF(a.dst IS NULL,n.nid, SUBSTRING_INDEX(a.dst, '/', -1)) 'post_name',
		DATE_ADD(FROM_UNIXTIME(0), interval n.changed second) 'post_modified',
		n.type 'post_type',
		IF(n.status = 1, 'publish', 'private') 'post_status',
		' ',
		' ',
		' '
	FROM drupal.node n
	INNER JOIN drupal.node_revisions r USING(vid)
	LEFT OUTER JOIN drupal.url_alias a
		ON a.src = CONCAT('node/', n.nid)
		WHERE n.type IN (
			/* List the content types you want to migrate */
			'page',
			'story',
			'blog',
			'video',
			'forum',
			'comment');
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Set the Drupal content types that should be migrated as WordPress 'posts'. In this case, I want &lt;em&gt;'page', 'story', 'blog', 'video', 'forum'&lt;/em&gt; and &lt;em&gt;'comment'&lt;/em&gt; in Drupal to be converted to posts in WordPress.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
UPDATE wordpress.wp_posts SET post_type = 'post'
	WHERE post_type IN (
		'page',
		'story',
		'blog',
		'video',
		'forum',
		'comment');
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now convert the remaining content types into WordPress pages.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
UPDATE wordpress.wp_posts SET post_type = 'page' WHERE post_type NOT IN ('post');
&lt;/pre&gt;&lt;/div&gt;

&lt;h3&gt;Housekeeping queries for terms&lt;/h3&gt;
&lt;p&gt;Here I associate the content with WordPress terms using the &lt;em&gt;wp_term_relationships&lt;/em&gt; table.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
INSERT INTO wordpress.wp_term_relationships (
	object_id,
	term_taxonomy_id)
	SELECT DISTINCT nid, tid FROM drupal.term_node;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;We need to update tag counts.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
UPDATE wordpress.wp_term_taxonomy tt
	SET count = ( SELECT COUNT(tr.object_id)
	FROM wordpress.wp_term_relationships tr
	WHERE tr.term_taxonomy_id = tt.term_taxonomy_id);
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now set the default WordPress category. You'll need to manually look in the database for the &lt;em&gt;term_id&lt;/em&gt; of the category you want to set as the default WordPress category.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
UPDATE wordpress.wp_options SET option_value='7520' WHERE option_name='default_category';
UPDATE wordpress.wp_term_taxonomy SET taxonomy='category' WHERE term_id=7520;
&lt;/pre&gt;&lt;/div&gt;

&lt;h3&gt;Migrate comments&lt;/h3&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
REPLACE INTO wordpress.wp_comments (
	comment_ID,
	comment_post_ID,
	comment_date,
	comment_content,
	comment_parent,
	comment_author,
	comment_author_email,
	comment_author_url,
	comment_approved)
	SELECT DISTINCT
		cid,
		nid,
		FROM_UNIXTIME(timestamp),
		comment,
		pid,
		name,
		mail,
		SUBSTRING(homepage,1,200),
		((status + 1) % 2) FROM drupal.comments;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Update comment counts.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
UPDATE wordpress.wp_posts
	SET comment_count = ( SELECT COUNT(comment_post_id)
	FROM wordpress.wp_comments
	WHERE wordpress.wp_posts.id = wordpress.wp_comments.comment_post_id);
&lt;/pre&gt;&lt;/div&gt;

&lt;h3&gt;Migrate Drupal Authors into WordPress&lt;/h3&gt;
&lt;p&gt;In this case I am migrating only users who have created a post. This was a requirement for my project but may be unnecessary for you.&lt;/p&gt;
&lt;p&gt;First delete all existing WordPress authors except for &lt;em&gt;admin&lt;/em&gt;.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
DELETE FROM wordpress.wp_users WHERE ID &amp;gt; 1;
DELETE FROM wordpress.wp_usermeta WHERE user_id &amp;gt; 1;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now set Drupal's admin password to a known value. This avoids hassles with trying to reset the password on the new WordPress installation. Resetting a user password in WordPress is more convoluted and cannot be done using a simple MySQL query as in Drupal.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
UPDATE drupal.users set pass=md5('password') where uid = 1;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Create a working table of users and the number of posts they've authored. I am only considering authors who have created posts of the content types I want to migrate.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
CREATE TABLE drupal.acc_users_post_count AS
SELECT
	u.uid,
	u.name,
	u.mail,
	count(n.uid) node_count
FROM drupal.node n
INNER JOIN drupal.users u on n.uid = u.uid
WHERE n.type IN (
	/* List the post types I migrated earlier */
	'page',
	'story',
	'blog',
	'video',
	'forum',
	'comment')
GROUP BY u.uid
ORDER BY node_count;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now add these authors into the WordPress &lt;em&gt;wp_users&lt;/em&gt; table.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
&lt;p&gt;INSERT IGNORE INTO wordpress.wp_users (
	ID,
	user_login,
	user_pass,
	user_nicename,
	user_email,
	user_registered,
	user_activation_key,
	user_status,
	display_name)
	SELECT DISTINCT
		u.uid,
		REPLACE(LOWER(u.name), ' ', '_'),
		u.pass,
		u.name,
		u.mail,
		FROM_UNIXTIME(created),
		",
		0,
		u.name
	FROM drupal.users u
	WHERE u.uid IN (SELECT uid FROM drupal.acc_users_post_count);
&lt;/p&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;First set all these authors to WordPress "author" by default. In the next MySQL query, we can selectively promote individual authors to other WordPress roles.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
&lt;p&gt;INSERT IGNORE INTO wordpress.wp_usermeta (
	user_id,
	meta_key,
	meta_value)
	SELECT DISTINCT
		u.uid,
		'wp_capabilities',
		'a:1:{s:6:"author";s:1:"1";}'
	FROM drupal.users u
	WHERE u.uid IN (SELECT uid FROM drupal.acc_users_post_count);	&lt;/p&gt;
&lt;p&gt;INSERT IGNORE INTO wordpress.wp_usermeta (
	user_id,
	meta_key,
	meta_value)
	SELECT DISTINCT
		u.uid,
		'wp_user_level',
		'2'
	FROM drupal.users u
	WHERE u.uid IN (SELECT uid FROM drupal.acc_users_post_count);
&lt;/p&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;During the course of the migration, some posts may end up not having an assigned author. Here I reassign authorship for these posts to the WordPress &lt;em&gt;admin&lt;/em&gt; user.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
UPDATE wordpress.wp_posts
	SET post_author = 1
	WHERE post_author NOT IN (SELECT DISTINCT ID FROM wordpress.wp_users);
&lt;/pre&gt;&lt;/div&gt;

&lt;h3&gt;Comment authors&lt;/h3&gt;
&lt;p&gt;In Drupal, comments are treated as nodes and comment authors are stored along with other node authors in the Drupal &lt;em&gt;users&lt;/em&gt; table. WordPress treats comments and comment authors differently. Comment authors in WordPress are not stored in the &lt;em&gt;wp_users&lt;/em&gt; table. Instead, they're stored along with the comment content itself in the &lt;em&gt;wp_comments&lt;/em&gt; table.&lt;/p&gt;
&lt;p&gt;We may need to run additional query to import users who have commented but haven't created any of the selected content types. To do this, I create some working tables required for some later MySQL queries:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;acc_users_with_comments:&lt;/em&gt; empty copy of wp_users&lt;/li&gt;
&lt;li&gt;&lt;em&gt;acc_users_add_commenters:&lt;/em&gt; empty copy of wp_users&lt;/li&gt;
&lt;li&gt;&lt;em&gt;acc_wp_users:&lt;/em&gt; copy of wp_users from wordpress database containing users&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Running the following MySQL queries will throw errors if you haven't created the required tables above.&lt;/p&gt;
&lt;p&gt;First create a working table of Drupal users who have created a Drupal comment.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
CREATE TABLE drupal.acc_users_comment_count AS
SELECT
	u.uid,
	u.name,
	count(c.uid) comment_count
FROM drupal.comments c
INNER JOIN drupal.users u on c.uid = u.uid
GROUP BY u.uid;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now add the author information for these users into another working table.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
INSERT IGNORE INTO drupal.acc_users_with_comments (
	ID,
	user_login,
	user_pass,
	user_nicename,
	user_email,
	user_registered,
	user_activation_key,
	user_status,
	display_name)
	SELECT DISTINCT
		u.uid,
		REPLACE(LOWER(u.name), ' ', '_'),
		u.pass,
		u.name,
		u.mail,
		FROM_UNIXTIME(created),
		",
		0,
		u.name
	FROM drupal.users u
	WHERE u.uid IN (SELECT uid FROM drupal.acc_users_comment_count);
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Using the above table, next build a working table of Drupal users who have commented but have not already been added to the WordPress &lt;em&gt;wp_users&lt;/em&gt; table.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
INSERT IGNORE INTO drupal.acc_users_add_commenters (
	ID,
	user_login,
	user_pass,
	user_nicename,
	user_email,
	user_registered,
	user_activation_key,
	user_status,
	display_name)
	SELECT DISTINCT
		u.ID,
		u.user_login,
		u.user_pass,
		u.user_nicename,
		u.user_email,
		u.user_registered,
		",
		0,
		u.display_name
	FROM drupal.acc_users_with_comments u
	WHERE u.ID NOT IN (SELECT ID FROM drupal.wp_users);
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Combine the tables into another working table &lt;em&gt;acc_wp_users&lt;/em&gt;.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
INSERT IGNORE
  INTO drupal.acc_wp_users
SELECT *
  FROM drupal.acc_users_add_commenters;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The &lt;em&gt;acc_wp_users&lt;/em&gt; working table helps when inspecting the user list. For example, you might want to clear out inactive users or spam posters. Once finished, remember to replace your WordPress &lt;em&gt;wp_users&lt;/em&gt; with the cleaned &lt;em&gt;acc_wp_users&lt;/em&gt; table. You may prefer to amend the above query to insert directly into the WordPress &lt;em&gt;wp_users&lt;/em&gt; table.&lt;/p&gt;
&lt;p&gt;I realise this is a rather round-about way of migrating comment authors from Drupal into WordPress but find that having working tables helps with debugging.&lt;/p&gt;

&lt;h3&gt;Housekeeping for WordPress options&lt;/h3&gt;
&lt;p&gt;Update file path for the WordPress installation.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content, '"/files/', '"/wp-content/uploads/');
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Set your WordPress site name using the Drupal &lt;em&gt;'site_name'&lt;/em&gt; variable.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
UPDATE wordpress.wp_options SET option_value = ( SELECT value FROM drupal.variable WHERE name='site_name') WHERE option_name = 'blogname';
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Set your WordPress site description using the Drupal &lt;em&gt;'site_slogan'&lt;/em&gt; variable.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
UPDATE wordpress.wp_options SET option_value = ( SELECT value FROM drupal.variable WHERE name='site_slogan') WHERE option_name = 'blogdescription';
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Set the WordPress site email address.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
UPDATE wordpress.wp_options SET option_value = ( SELECT value FROM drupal.variable WHERE name='site_mail') WHERE option_name = 'admin_email';
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Set the WordPress permalink structure. Here we're using &lt;em&gt;/%postname%/&lt;/em&gt; but you may set it according your own needs.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
UPDATE wordpress.wp_options SET option_value = '/%postname%/' WHERE option_name = 'permalink_structure';
&lt;/pre&gt;&lt;/div&gt;

&lt;h3&gt;Create URL redirects table&lt;/h3&gt;
&lt;p&gt;This table will not be used for the migration but may be useful if you need to manually create redirects from Drupal aliases. You will need the entries here for search engine optimisation (SEO) of your new WordPress site.&lt;/p&gt;

&lt;div class="code"&gt;&lt;pre class="code sql"&gt;
DROP TABLE IF EXISTS drupal.acc_redirects;
CREATE TABLE drupal.acc_redirects AS
	SELECT
		CONCAT('drupal/',
			IF(a.dst IS NULL,
				CONCAT('node/', n.nid),
				a.dst
			)
		) 'old_url',
		IF(a.dst IS NULL,n.nid, SUBSTRING_INDEX(a.dst, '/', -1)) 'new_url',
		'301' redirect_code
	FROM drupal.node n
	INNER JOIN drupal.node_revisions r USING(vid)
	LEFT OUTER JOIN drupal.url_alias a
		ON a.src = CONCAT('node/', n.nid)
		WHERE n.type IN (
		/* List the post types I migrated earlier */
			'page',
			'story',
			'blog',
			'video',
			'forum',
			'comment');
&lt;/pre&gt;&lt;/div&gt;

&lt;h2&gt;Finalising the conversion&lt;/h2&gt;
&lt;p&gt;Now that we've finished converting the content over from Drupal to WordPress, we have the rather (not very) fun job of checking the content, setting up any WordPress plugins and widgets, then finally going live. Depending on the complexity of your Drupal installation, this process can be extremely time-consuming and perhaps form a separate project in its own right.&lt;/p&gt;

&lt;h2&gt;Accepting limitations&lt;/h2&gt;
&lt;p&gt;Before finishing this article, one point I'd like to convey is the importance of accepting the limitations of any migration process. You, or your client, may be insistent on turning your new WordPress site into an exact copy of your former Drupal installation. While this may be technically possible, there comes a point of diminishing returns where the work you'd need to put in just isn't worth the value of the data.&lt;/p&gt;
&lt;p&gt;It may also be more productive in some instances to make manual adjustments via the WordPress control panel than to try anything clever using the backend database. Sometimes the time needed to write, test and debug MySQL queries far exceeds the boring but more reliable editing using the web-front end.&lt;/p&gt;
&lt;p&gt;Expect to kill your SEO if you're not careful with the migration. A site that relies heavily on revenue from search engine rankings will need extra steps to preserve SEO. This is a huge topic so I will not cover it here but you should carefully plan the conversion steps before starting with the migration. Pay particular attention to preserving Drupal path aliases, taxonomy listing pages and internal links.&lt;/p&gt;


&lt;h2&gt;Drupal to WordPress migration activity diagram&lt;/h2&gt;

This UML activity diagram illustrates the steps during the migration.

&lt;figure class="figure d-flex flex-column align-items-center"&gt;
    &lt;img src="https://migratecontent.com/images/Drupal-to-WordPress-migration-activity-diagram.png" alt="Drupal to WordPress migration process activity diagram" width="569" height="1081" class="figure-img img-fluid rounded"&gt;
    &lt;figcaption&gt;Drupal to WordPress migration process activity diagram created with &lt;a href="https://www.draw.io"&gt;draw.io&lt;/a&gt;.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;Migration steps listing&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Prepare tables: This is where we reset the development database tables to a known state, ready for another migration pass.&lt;/li&gt;
&lt;li&gt;Delete unwanted vocabularies&lt;/li&gt;
&lt;li&gt;Delete unwanted terms&lt;/li&gt;
&lt;li&gt;Merge terms? Yes: go to step &lt;em&gt;a&lt;/em&gt;; No: go to step &lt;em&gt;5&lt;/em&gt;
&lt;ol style="list-style-type: lower-latin;"&gt;
&lt;li&gt;Create tables for each vocabulary to merge&lt;/li&gt;
&lt;li&gt;Create duplicate table for each vocabulary&lt;/li&gt;
&lt;li&gt;Make duplicate terms unique&lt;/li&gt;
&lt;li&gt;Merge terms&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Create tags&lt;/li&gt;
&lt;li&gt;Create categories and sub-categories&lt;/li&gt;
&lt;li&gt;Set uncategorized term&lt;/li&gt;
&lt;li&gt;Create posts from nodes&lt;/li&gt;
&lt;li&gt;Set posts and page types&lt;/li&gt;
&lt;li&gt;Associate posts with terms&lt;/li&gt;
&lt;li&gt;Update tag counts&lt;/li&gt;
&lt;li&gt;Set default category&lt;/li&gt;
&lt;li&gt;Migrate comments&lt;/li&gt;
&lt;li&gt;Migrate authors&lt;/li&gt;
&lt;li&gt;Site-specific settings and customisation: this would include WordPress site information settings and URL redirects&lt;/li&gt;
&lt;/ol&gt;



&lt;h2&gt;Good luck!&lt;/h2&gt;
&lt;p&gt;So that's it. A Drupal to WordPress migration can be a great deal of effort. I've had one project that initially looked like only couple of hours work balloon to over 50 billable hours in total. Previously installed modules caused problems requiring custom MySQL queries and PHP scripting to resolve. On the other hand, I've had a number of sites that completed in 15 minutes after running my Drupal to WordPress migration tool.&lt;/p&gt;
&lt;p&gt;Overall, the majority of my clients prefer WordPress over their previous Drupal site. I personally find WordPress quicker to update and manage. Any short-term hassles with migrating have been outweighed by the long-term advantages of easier maintenance.&lt;/p&gt;
&lt;h3&gt;Getting the code and submitting improvements&lt;/h3&gt;
&lt;p&gt;You can find the code on my &lt;a href="https://github.com/anothercoffee/drupal-to-wordpress"&gt;GitHub repository&lt;/a&gt;. The queries in this article can be found in the file &lt;a href="https://github.com/anothercoffee/drupal-to-wordpress/blob/master/drupaltowordpress-custom.sql"&gt;drupaltowordpress-custom.sql&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I'd love to receive corrections, bug fixes and suggestions for improvements. Please &lt;a href="https://migratecontent.com/contact/"&gt;contact me&lt;/a&gt; or &lt;a href="https://github.com/anothercoffee/drupal-to-wordpress/issues"&gt;submit an issue&lt;/a&gt; on GitHub.&lt;/p&gt;

&lt;div class="alert alert-danger"&gt;
&lt;strong&gt;CAUTION:&lt;/strong&gt; Make a backup of both your Drupal and WordPress databases before running these queries. USE IS ENTIRELY AT YOUR OWN RISK. I'm offering this information with no warranty or support implied.
&lt;/div&gt;


&lt;section class="breakout-white"&gt;
&lt;div class="breakout-inner text-center"&gt;

&lt;h2&gt;Need Help With Your Drupal to WordPress Migration?&lt;/h2&gt;

&lt;p&gt;I specialise in complex Drupal to WordPress migrations using custom SQL scripts tailored to your site's specific data model. Get a free, no-obligation consultation to discuss your project.&lt;/p&gt;

&lt;div class="button-container" style="margin:2em 0;"&gt;
&lt;a class="cta-button" href="https://migratecontent.com/contact/" title="Get a quote for your Drupal to WordPress migration"&gt;Get a Free Quote&lt;/a&gt;
&lt;/div&gt;

&lt;/div&gt;
&lt;/section&gt;</description><category>database</category><category>drupal</category><category>migration</category><category>sql</category><category>wordpress</category><guid>https://migratecontent.com/drupal-to-wordpress-migration-sql-queries-explained/</guid><pubDate>Mon, 23 Jun 2014 15:43:18 GMT</pubDate></item><item><title>Drupal to WordPress migration notes</title><link>https://migratecontent.com/drupal-to-wordpress-migration-notes/</link><dc:creator>Anthony Lopez-Vito</dc:creator><description>These Drupal to WordPress migration notes are intended for clients who are handling some aspects of the migration themselves. Users of the &lt;a href="https://migratecontent.com/the-drupal-to-wordpress-migration-tool/"&gt;Drupal to WordPress Migration Tool&lt;/a&gt; or &lt;a href="https://migratecontent.com/drupal-to-wordpress-migration-sql-queries-explained/"&gt;MySQL queries&lt;/a&gt; might also find information here to resolve some problems.
&lt;h2&gt;Admin account password and email address&lt;/h2&gt;
Your content management system (CMS) administrator password and email address may have changed during the migration to help with debugging. Please update them as soon as possible.

Drupal and WordPress user passwords are encrypted and I do not have access to them in plaintext. However, for your peace of mind, I recommend that you also ask all your users to reset their passwords.
&lt;h2&gt;Server credentials&lt;/h2&gt;
Please remember to change any database, (S)FTP, SSH server and control panel credentials you may have given me.
&lt;h2&gt;Working tables&lt;/h2&gt;
During the migration process, I may create some working tables to hold temporary data. My naming convention for the working tables are as follows:
&lt;ul&gt;
 	&lt;li&gt;&lt;strong&gt;acc_ prefix:&lt;/strong&gt; these are working tables created to help with migrating data.&lt;/li&gt;
 	&lt;li&gt;&lt;strong&gt;backup_ prefix:&lt;/strong&gt; these are backups of existing tables prior to migration, for example from a previous installation of your CMS. These will not be altered during the migration process.&lt;/li&gt;
 	&lt;li&gt;&lt;strong&gt;_copy postfix:&lt;/strong&gt; duplicates of WordPress tables copied for debugging will have a _copy postfix. These are different from the backup_ tables in that they may have been manually altered.&lt;/li&gt;
&lt;/ul&gt;
These working tables are not used by WordPress so you may safely delete them. However, it's advisable to keep them for a short while as they may be useful in case we need to debug any issues that crop up.
&lt;h2&gt;Migrating to a live server&lt;/h2&gt;
Most Drupal to WordPress migrations are performed on a test or development server. For help on how to move WordPress to your live server, please see: &lt;a href="http://codex.wordpress.org/Moving_WordPress"&gt;WordPress Codex: Moving WordPress&lt;/a&gt;.
&lt;h2 id="troubleshooting"&gt;Troubleshooting common errors after a site migration&lt;/h2&gt;
Please see below for some common problems you may experience after migrating your Drupal content to a new WordPress site.
&lt;h3&gt;Incorrect domain in URLs&lt;/h3&gt;
WordPress stores domains in the database. If you performed the migration on a local or development server, there's a good chance that the links will be incorrect after migrating to your live server. Use the Interconnect IT utility to run a search and replace on your database. This will also correct changed database prefixes.

More information can be found on the interconnect/it &lt;a href="https://interconnectit.com/products/search-and-replace-for-wordpress-databases/"&gt;Search Replace DB page&lt;/a&gt;.
&lt;h3&gt;"Sorry, you are not allowed to access this page"&lt;/h3&gt;
If you try to log in via &lt;em&gt;wp-admin&lt;/em&gt; and receive this error, you may have overwritten the administrator user's &lt;em&gt;wp_capabilities&lt;/em&gt; or &lt;em&gt;wp_user_level&lt;/em&gt;.

Set the correct meta_value using the following SQL:
&lt;pre&gt;&lt;code&gt;UPDATE wp_usermeta 
    SET meta_value = 'a:1:{s:13:"administrator";s:1:"1";}'
    WHERE user_id = 1 AND meta_key = 'wp_capabilities';

UPDATE wp_usermeta 
    SET meta_value = '10'
    WHERE user_id  = 1 AND meta_key = 'wp_user_level';&lt;/code&gt;&lt;/pre&gt;
Remember to use the appropriate the &lt;em&gt;user_id&lt;/em&gt;.
&lt;h3&gt;"You do not have sufficient permissions to access this page"&lt;/h3&gt;
If you receive this error after logging in to your new WordPress installation, it's possible that the database prefix on your new WordPress site is not set correctly. This may happen if you move your WordPress installation to a host that uses a different database prefix.

Try running one of the queries below. Replace wp_new_usermeta, oldprefix_ and newprefix_ as appropriate.

Option 1:
&lt;div class="codelisting"&gt;
UPDATE wp_new_usermeta SET meta_key = REPLACE(meta_key,'oldprefix_','newprefix_');

UPDATE wp_new_options SET option_name = REPLACE(option_name,'oldprefix_','newprefix_');

&lt;/div&gt;
Option 2:
&lt;div class="codelisting"&gt;
update wp_new_usermeta set meta_key = 'newprefix_usermeta' where meta_key = 'wp_capabilities';

update wp_new_usermeta set meta_key = 'newprefix_user_level' where meta_key = 'wp_user_level';

update wp_new_usermeta set meta_key = 'newprefix_autosave_draft_ids' where meta_key = 'wp_autosave_draft_ids';

update wp_new_options set option_name = 'newprefix_user_roles' where option_name = 'wp_user_roles';

&lt;/div&gt;
Please note that these queries may not work for you. Success depends on your specific setup.

For more information, please see the following pages:
&lt;ul&gt;
 	&lt;li&gt;&lt;a href="http://wordpress.org/support/topic/you-do-not-have-sufficient-permissions-to-access-this-page-98"&gt;WordPress forums: You do not have sufficient permissions to access this page&lt;/a&gt;&lt;/li&gt;
 	&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/13815461/you-do-not-have-sufficient-permissions-to-access-this-page-without-any-change"&gt;stackoverflow: You do not have sufficient permissions to access this page without any change&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;"Unable to establish database connection"&lt;/h3&gt;
The database credentials are correct but you see an "Unable to establish database connection" error. Check that wp_options table is not empty.
&lt;h3&gt;Allowed memory size exhausted&lt;/h3&gt;
&lt;ol&gt;
 	&lt;li&gt;Increase php.ini memory size&lt;/li&gt;
 	&lt;li&gt;Increase WP settings memory limit with:
&lt;div class="codelisting"&gt;
define('WP_MEMORY_LIMIT', '128M');&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Post migrated but navigating to post shows blank page&lt;/h3&gt;
The post is visible in the dashboard but viewing it displays a blank (but themed) page. Manually saving it on the dashboard makes it appear.

It's possible that the problem posts need to be assigned to a category.
&lt;h3&gt;Post migrated but navigating to post shows 'Not found' error&lt;/h3&gt;
The post is visible in the dashboard but viewing it displays a 'not found' error. Manually saving it on the dashboard makes it appear.
&lt;ol&gt;
 	&lt;li&gt;Check that the url contains &lt;a href="https://migratecontent.com/drupal-wordpress-migration-seo#wordpress_permalink_constraints" title="WordPress permalink constraints"&gt;valid characters&lt;/a&gt; for a WordPress slug.&lt;/li&gt;
 	&lt;li&gt;Check that .htaccess is enabled in your Apache configuration&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Link to author 404&lt;/h3&gt;
Posts exist but link to the author's post listing page is broken.

Check user_nicename in wp_users WordPress table. Make sure the nicename doesn't contain invalid characters such as spaces, periods.
&lt;h3&gt;Dashboard controls not visible after logging in&lt;/h3&gt;
If you are able to log in as an administrator user but do not see the Dashboard controls, check your table prefixes. If the table prefixes changed during the migration, you may have forgotten to update the &lt;em&gt;options&lt;/em&gt; and &lt;em&gt;usermeta&lt;/em&gt; tables.

Check where the old prefixes have been set:
&lt;pre&gt;&lt;code&gt;SELECT * FROM `wpnew_options` WHERE `option_name` LIKE '%wp_%';
SELECT * FROM `wpnew_usermeta` WHERE `meta_key` LIKE '%wp_%';&lt;/code&gt;&lt;/pre&gt;
Updated the prefixes. For example:
&lt;pre&gt;&lt;code&gt;UPDATE `wpnew_options` SET `option_name` = 'wpnew_user_roles' WHERE `option_name` = 'wp_user_roles';
UPDATE `wpnew_usermeta` SET `meta_key` = 'wpnew_capabilities' WHERE `meta_key` = 'wp_capabilities';
UPDATE `wpnew_usermeta` SET `meta_key` = 'wpnew_user_level' WHERE `meta_key` = 'wp_user_level';

UPDATE `wpnew_usermeta` SET `meta_key` = 'wpnew_user-settings-time' WHERE `meta_key` = 'wp_user-settings-time';
UPDATE `wpnew_usermeta` SET `meta_key` = 'wpnew_user-settings' WHERE `meta_key` = 'wp_user-settings';&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Further help&lt;/h2&gt;
We'll be very happy to provide support you if have difficulties after migration. For a quotation, please &lt;a href="https://migratecontent.com/#contact"&gt;contact us&lt;/a&gt;. We also offer customised hosting and maintenance packages. Please ask for details.</description><category>database</category><category>drupal</category><category>migration</category><category>sql</category><category>troubleshooting</category><category>wordpress</category><guid>https://migratecontent.com/drupal-to-wordpress-migration-notes/</guid><pubDate>Wed, 22 Jan 2014 11:25:42 GMT</pubDate></item></channel></rss>