ajoo Posted April 1, 2017 Share Posted April 1, 2017 Hi all ! My windows crashed and I imported my database into the new installation of xampp on my new HD. All the primary keys and auto-increments were lost and for 2 days i nearly pulled my hair out, before I figured out why my application was behaving so strangely . The database on my previous HD is intact and I need to import it so that all prmary keys and other relational integrity is a maintained after the import. What should I do ? With so many tables in the database, it would be a huge task if I have to do this manually for each table. Please help !!!!!!!!!! ( why is php freaks logo and title doing a Guru Jacques !?! ) Thanks all. Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted April 1, 2017 Share Posted April 1, 2017 mysqldump Quote Link to comment Share on other sites More sharing options...
ajoo Posted April 2, 2017 Author Share Posted April 2, 2017 (edited) Hi Guru Jacques !! Thanks for the reply ! Forgive me if I am wrong, but isn't the export command in phpmyadmin the same as mysqldump? I used the export command to get my dump. I used the quick export method with the SQL format chosen. It resulted in all tables losing primary keys and thereby the ability to Auto increment. It may have also broken the referential integrity between tables. I haven;t checked that yet. If I still need to use mysqldump, then with what options, if any ? Please elaborate a bit, Thanks loads ! Edited April 2, 2017 by ajoo Quote Link to comment Share on other sites More sharing options...
Solution Jacques1 Posted April 2, 2017 Solution Share Posted April 2, 2017 Whatever phpmyadmin is doing, it's obviously not doing the right thing. So forget about it for now and use the standard backup tool. mysqldump creates a full backup, including all keys, counters and whatnot. You generally don't have to set any special options (only --routines if you have stored procedures). 1 Quote Link to comment Share on other sites More sharing options...
NigelRel3 Posted April 2, 2017 Share Posted April 2, 2017 If you look at the script that phpmyadmin has created, does it contain the commands to add the constraints back in (They should be near the bottom ) Something along the lines of... -- -- Constraints for dumped tables -- -- -- Constraints for table `ActivityIn` -- ALTER TABLE `ActivityIn` ADD CONSTRAINT ... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.