简体   繁体   中英

magento migration from one domain to another

I am transferring my magento site from an old domain to a new domain.

I have exported the database file from the old server and I have done all the necessary changes.

Now I'm trying to run the exported file into the new database but sql is stuck at loading for almost an hour.

Please somebody help.

See loading screen attached. Image here

Thank you.

I would suggest making a backup of the whole 'cPanel' and then reimport it back in. This way you won't mess anything up with the database. If you still do need to perform exporting and reimporting back - make sure you disable the key check by adding this before and after your database.

SET foreign_key_checks = 0;
SET foreign_key_checks = 1;

And to successfully import large database you must increase the memory limit on your 'mysql' within '.ini' file.

I wouldn't do it through a GUI interface. Do you have SSH access? If so, here's how you can run it from Command Line which won't be limited by browser processing.

dump:

mysqldump -u '<<insert user>>' -p --single-transaction --database <<database name>> > data_dump.sql

load:

 mysql -p -u '<<insert user>>' <<database name>> < data_dump.sql 

It's best to do this as the root user so you don't have any trouble.

On import, if you are getting errors that the definer is not a user, you can either create the definer user or you can run this sed command that will replace the definer in your file with the current mySQL user:

sed -E 's/DEFINER=`[^`]+`@`[^`]+`/DEFINER=<<new user name>>/g' data_dump.sql > cleaned_data_dump.sql

As espradley and damek132 said, combine both the answers. Disable foreign key checks, if it's not. But, mostly it's there while exporting the sql dump. And use the mysql command line through ssh. You should be up and running in half an hour.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM