I was cloning a database in
MySQL using the following command:
$user@host: mysqldump -u root -p MyOriginalDatabase | mysql -u root -p MyDatabaseCopy
And the output was the following:
Enter password: Enter password:
I entered the password and it stayed in the execution of this without stopping or showing a result, however , it generated the copy correctly so I ended up canceling the execution with a keyboard interruption ( ctrl + c )
I tried to make another copy with the same command just by changing the name of the copy:
$user@host: mysqldump -u root -p MyOriginalDatabase | mysql -u root -p MyDatabaseCopy2
However, it generated the following error:
ERROR 1049 (42000): Unknown database 'MyDatabaseCopy2'
It never finished the execution and it did not copy the database correctly.
- Why did it work correctly the first time and then not?
- Why did the execution never end in both cases?
- What is the most optimal and recommended way to clone a base of