This is an old revision of the document!


IMPORTING MYSQL DUMP

Author: Demi
Thanks-To: Paul and Blake
Date: June 18, 2006

Trying to import a dbmail dump might give you these errors:

ERROR 1146: Table 'dbmail.dbmail_messageblks' doesn't exist
ERROR 1005: Can't create table './dbmail/dbmail_messages.frm' (errno: 150)
ERROR 1005: Can't create table './dbmail/dbmail_subscription.frm' (errno: 150)

The fix:

# mysql -u dbmail -p dbmail
mysql> SET FOREIGN_KEY_CHECKS=0;
mysql> SET SQL_LOG_OFF=1;
mysql> SET SQL_LOG_UPDATE=0;
mysql> source /path/to/dbmail.sql

The reason:

When importing tables with foreign key constraints, it is sometimes impossible to load them in an order that never violates the constraints. Rather than trying to play the with data, we simply turn off foreign key checks, load the data, and then turn them back on. Note that foreign key checks are disabled on a per-session basis; you don't need to worry that they've been turned off for everyone or anything like that.

 
restoring_a_dump.1155502144.txt.gz · Last modified: 2011/08/02 09:00 (external edit)
 
DBMail is developed by Paul J Stevens together with developers world-wide