Posts Tagged: mysql

Foreign key restraints

Posted by & filed under Magento, mySQL.

Trying to import a Magento table into a database (drop table if exists) I got an error: The way to get round this is to remove the foreign key constraint CHECK, delete the table, then add the check again:

Moving a WordPress database to another domain

Posted by & filed under Wordpress.

Here are the SQL queries to update a WordPress database from one domain to another: # define var for old site SET @old_path = ‘http://oldsite.com’ COLLATE utf8mb4_unicode_ci; # set var for new site SET @new_path = ‘http://newsite.com’ COLLATE utf8mb4_unicode_ci; UPDATE wp_options SET option_value = replace( option_value, @old_path, @new_path ) WHERE option_name = ‘home’ OR option_name… Read more »