Reputation: 543
I've seen a few posts about insert a table into another table (with the same columns) but i'm having trouble figuring out how to do this across different databases. I see that you reference the database first with the dot operator and then the table ie. database.table but the databases are completely separate instances (separate login credentials etc.) when i reference one database the another database doesn't recognize it. What would be the best way to accomplish what it is i'm trying to do?
I running the DBs on AWS if that helps
Upvotes: 0
Views: 24
Reputation: 522
once logged in, there is no way to connect to another database (as far as I know - please correct me if I'm wrong). so you have to have to export your data first and then import it.
mysqldump
is the tool for exporting, e.g. mysqldump -h HOST -u USER -p database table > export.sql
import it then via e.g. mysql -h HOST -u USER -p database table < export.sql
Upvotes: 1