How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask adamd-mod Your Own Question
adamd-mod
adamd-mod, Computer Hardware Engineer
Category: Programming
Satisfied Customers: 9
Experience:  Moderator
74353250
Type Your Programming Question Here...
adamd-mod is online now

In mysql (in linux) lets say that we dump a database called

Customer Question

Hello, in mysql (in linux) lets say that we dump a database called "database_1". In order to import it to another computer we need to first create a database called "database_1" or there is a command that does the combined step of database creation and importing? If yes please give this command. In addition, please give an example of a mysql script that creates a database called "database_1" that contains an entry only (name: ***** *****, age: 24).
Submitted: 1 year ago.
Category: Programming
Expert:  chrisaw replied 1 year ago.

Hi Georgios,

You do have to create the database before you are able to restore to it with MySQL yes but you can do this from command-line along with the restore script as follows:

Create Backup:

mysqldump -u [user] -p database_1 > backup.sql

Restore Backup:

mysql -u [user] -p -e "create database database_1";

mysql -u [user] -p database_1 < backup.sql

Note: Please replace [user] with the username you want to use to backup and restore these databases. If you don't know what this should be - it should likely be root.

Customer: replied 1 year ago.
Hello, this is clear for command by command execution. Could you please also give an example of creating and running a script doing exactly the same?
Expert:  adamd-mod replied 1 year ago.
Hello,
It seems the professional has left this conversation. This happens occasionally, and it's usually because the professional thinks that someone else might be a better match for your question. I've been working hard to find a new professional to assist you with your question, but sometimes finding the right professional can take a little longer than expected.
I wonder whether you're OK with continuing to wait for an answer. If you are, please let me know and I will continue my search. If not, feel free to let me know and I will cancel this question for you.
Thanks for your patience,
Customer: replied 1 year ago.
Hello,Kindly take not that in all similar cases of difficulty in finding a Professional to address my question my answer is to continue for a couple of days.Thanks,
George
Expert:  adamd-mod replied 1 year ago.
Hello,
Thanks for getting back to me.
We will continue to look for a Professional to assist you.
Thank you for your patience,
Adam
Customer: replied 1 year ago.
close the question please