Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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!

share|improve this question
    
Do you need the entire database, or just the site content exported/imported? –  Chip Bennett Feb 21 '12 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. –  chrisguitarguy Feb 21 '12 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 –  Brian Fegter Feb 21 '12 at 17:32
    
@ChristopherDavis and BrianFegter answers should be posted as answers, not as comments. :) –  Chip Bennett Feb 21 '12 at 18:50
    
Done! I was kind of expecting this Q to be deleted as it's not really WordPress specific. –  chrisguitarguy Feb 21 '12 at 20:16

4 Answers 4

up vote 0 down vote accepted

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

share|improve this answer
    
Wow, thanks! Have to try. –  Alexander Savin Feb 22 '12 at 9:26
    
Worked as charm, thanks! –  Alexander Savin Feb 22 '12 at 10:07

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.

share|improve this answer

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 
share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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