I have two tables , I am exporting this two table schema and renamed it. Again I am importing the same into it.
Script
mysql -uroot audit --add-drop-table=false --no-data SignInAudit UAAudit > out.sql
mysql -uroot audit -e "RENAME TABLE SignInAudit TO SignInAudit1"
mysql -uroot audit -e "RENAME TABLE UAAudit TO UAAudit1"
#Create the table again.
mysql -uroot audit < out.sql
Schema
CREATE TABLE `SignInAudit` (
`SID` int(11) NOT NULL,
`Uname` varchar(100) DEFAULT NULL,
`IP` varchar(255) DEFAULT NULL,
`LOGIN_TIME` bigint(20) DEFAULT NULL,
PRIMARY KEY (`SID`)
) ENGINE=InnoDB
CREATE TABLE `UAAudit` (
`SID` int(11) NOT NULL,
`UserAgent` varchar(255) DEFAULT NULL,
PRIMARY KEY (`SID`),
CONSTRAINT `UAAudit_ibfk_1` FOREIGN KEY (`SID`) REFERENCES `SignInAudit` (`SID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
I got this error ERROR 1005 (HY000)
. It may be due to "UAAudit" is referencing "SignInAudit". But , I am exporting in correcting order (SignInAudit , UAAudit).
How can I import the sql?