views:

51

answers:

1

I have a MySQL database from a Joomla MultiSite installation where it has a set of tables with different prefixes for each Joomla site. When I export the db via phpMyAdmin it creates a SQL file where the tables are created and populated in alphabetical order. The problem is that the tables for the slave sites have dependencies on the tables for the master site, but alphabetically their prefixes are ahead of the master site. So the export works fine but when I try importing I get error after error and have to manually move sections around in the SQL file to make sure that the dependent tables are created/populated first.

So, is it possible to export a db via phpMyAdmin with the tables in a specific order?

EDIT: Here's the error I'm getting which should clarify things:

Error

SQL query: Documentation

--
-- Dumping data for table `j1_content_rating`
--
-- --------------------------------------------------------
--
-- Table structure for table `j1_core_acl_aro`
--
CREATE ALGORITHM = UNDEFINED DEFINER = `bookings_bpjms`@`localhost` SQL SECURITY DEFINER VIEW `bookings_bpjms`.`j1_core_acl_aro` AS SELECT `bookings_bpjms`.`js0_core_acl_aro`.`id` AS `id` , `bookings_bpjms`.`js0_core_acl_aro`.`section_value` AS `section_value` , `bookings_bpjms`.`js0_core_acl_aro`.`value` AS `value` , `bookings_bpjms`.`js0_core_acl_aro`.`order_value` AS `order_value` , `bookings_bpjms`.`js0_core_acl_aro`.`name` AS `name` , `bookings_bpjms`.`js0_core_acl_aro`.`hidden` AS `hidden`
FROM `bookings_bpjms`.`js0_core_acl_aro` ;

MySQL said: Documentation
#1146 - Table 'bookings_bpjms.js0_core_acl_aro' doesn't exist 

The js0_ portions of the import script come after the j1_ portions, and so this error occurs. If I edit this file in a text editor (30+ megs and growing every day) I can find the js0_ portions and move them to the top, but this is tedious, time consuming and error prone.

A: 

Is the problem foreign key checks (in which case a SET FOREIGN_KEY_CHECKS=0 at the start of the file should work), or is the problem simply importing in a live environment?

With mysqldump it seems the tables are dumped in the order you give them in (if you specify tables instead of just a database), but this is undocumented behavior as far as I know and hence should not be relied upon.

Wrikken