Report this

What is the reason for this report?

How do I insert data from local database to the new database with tables that I have just created in command line?

Posted on June 12, 2015

In my local database, I have hundreds of data and it would be a worrisome for me if I have to insert all over again one by one. Is there any way I export the local data mysql to the server database so my website (php) can display those data. Please help and I would be really grateful. Thank you.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This question was answered by @sierracircle:

For your local database you can do this:

mysqldump  --user=YOURMYSQLUSER --password=YOURPASSWORD  --host=localhost YOURDATABASE > thedata.sql

which will create a data file with all of your data. then, upload that file to your server (your users home directory), and then run this command:

mysql --user=YOURMYSQLUSER --password=YOURPASSWORD  --host=localhost YOURDATABASE < thedata.sql

View the original comment

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.