1

I'm migrating our WordPress site from one server to another. I need some hint on how to deploy a database dump (which I have) from the original server to the new one. There is no phpmyadmin (at least I don't have access to it), so I need to copy the dump using console. Or maybe there is some WordPress plugin for this?

Thanks in advance!

6
  • Do you need the entire database, or just the site content exported/imported? Commented Feb 21, 2012 at 16:09
  • You can do it via the shell: mysql -u your_user_name -p your_database < ./yoursqlfile.sql. It will ask your your password then go. If you just need the site content, use the WordPress exporter/importer. Much easier. Commented Feb 21, 2012 at 16:37
  • 1
    @ChristopherDavis Alternatively the old IP can be whitelisted on the new server and run this from the old - mysqldump -u user_name -ppassword -h new_host db_name < /path/to/sql_file.sql Commented Feb 21, 2012 at 17:32
  • @ChristopherDavis and BrianFegter answers should be posted as answers, not as comments. :) Commented Feb 21, 2012 at 18:50
  • Done! I was kind of expecting this Q to be deleted as it's not really WordPress specific. Commented Feb 21, 2012 at 20:16

4 Answers 4

0

phpmyadmin as a plugin: WordPress › Portable phpMyAdmin « WordPress Plugins

0
0

You can import the database in your server's shell easily. Just export the current database into a .sql file, upload it to the new server, SSH in and cd into the directory with the .sql dump of your old database and run this.

mysql -u your_mysql_user -p your_database < ./your_sql_file.sql

As Brian Fegter pointed out, you can also dump the file in from your old server. Add the old server's IP to your new servers whitelist and run the following from the old server's shell:

mysql -u your_mysql_user -p -h new_server_host database_name < /path/to/sql_file.sql

Both will prompt your for a password then run.

If you just need the content, use the WordPress exporter, which will require 100% less command line fu.

0

You could do a migration directly from your old server to your new server without download/uploading a large sql dump. You can contact your new host to have them whitelist the old server IP for remote mysql.

Then, run this on your old server.

mysqldump -u user_name -ppassword -h new_host_address db_name < /path/to/sql_file.sql 
0

PHPMyAdmin is pretty common if your hosting company does not have it installed for you, I would send them the dump and ask they do it. Otherwise using Navicat you can pretty much drag and drop from one database to another and copy all the data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.